Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

Dos Batch File Help

Thread Tools
 
Search this Thread
 
Old 27 May 2003, 01:12 PM
  #1  
rik1471
Scooby Regular
Thread Starter
 
rik1471's Avatar
 
Join Date: Nov 2001
Posts: 4,788
Likes: 0
Received 0 Likes on 0 Posts
Post

I am trying to create a batch file which asks for a user to enter a number, then it creates a directory with that number as the name;

I have up to now:

set /p input="Enter Number>"

How can I pull the string from that variable I have just set?

I could set input >> text.txt then how do I delete the "input=" part from the text file?

Any ideas??
Old 27 May 2003, 01:30 PM
  #2  
David_Wallis
Scooby Regular
 
David_Wallis's Avatar
 
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like on 1 Post
Post

echo %input%

or

set /p input="Enter Number>"
md %input%

David
Old 27 May 2003, 01:35 PM
  #3  
rik1471
Scooby Regular
Thread Starter
 
rik1471's Avatar
 
Join Date: Nov 2001
Posts: 4,788
Likes: 0
Received 0 Likes on 0 Posts
Post

You are the man.
Old 27 May 2003, 02:30 PM
  #4  
rik1471
Scooby Regular
Thread Starter
 
rik1471's Avatar
 
Join Date: Nov 2001
Posts: 4,788
Likes: 0
Received 0 Likes on 0 Posts
Post

Ok, now how do I create a number of files depending on how many files are in a directory;

e.g.

If c:\files contains 14 files, I need to create a text file:
1.txt-->14.txt each i.e.

1.txt contains: http://link1.htm
2.txt contains: http://link2.htm

etc. all the way up to 14.txt, but sometimes there could be more or less files.

Thanx.
Old 27 May 2003, 03:09 PM
  #5  
David_Wallis
Scooby Regular
 
David_Wallis's Avatar
 
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like on 1 Post
Post

does it have to be a batch file??

David
Old 27 May 2003, 03:16 PM
  #6  
rik1471
Scooby Regular
Thread Starter
 
rik1471's Avatar
 
Join Date: Nov 2001
Posts: 4,788
Likes: 0
Received 0 Likes on 0 Posts
Post

No, but I can't program.
Old 27 May 2003, 03:53 PM
  #7  
David_Wallis
Scooby Regular
 
David_Wallis's Avatar
 
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like on 1 Post
Post

Option Explicit

Dim OShell, FSys, Fsys1, XFile, XFiles, xFolder, TempFile
Dim Count, Folder, OutFolder, Line

Count = 0

' Set the location of the files
Folder = "C:\"

' Set The output Folder
OutFolder = "C:\"

Set oShell = WScript.CreateObject("WScript.Shell")
Set FSys = CreateObject("Scripting.FileSystemObject")
Set xFolder = FSys.GetFolder(folder)
Set xFiles = xFolder.Files

For Each xFile In xFiles
Count = Count + 1
WScript.Echo "Processing File " & Count & ": " & xFile.Name

Set FSys1 = CreateObject("Scripting.FileSystemObject")
Set TempFile = Fsys1.CreateTextFile(OutFolder & Count & ".txt", True)

' Line to write to file
Line = "Http://link" & Count & ".htm"

TempFile.WriteLine(Line)
TempFile.Close

Set Fsys1 = Nothing
Next
Old 27 May 2003, 03:55 PM
  #8  
David_Wallis
Scooby Regular
 
David_Wallis's Avatar
 
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like on 1 Post
Post

Click on edit on my post...

Copy and paste into notepad, save as "File.Vbs" or whatever..

then call from a batch file by doing

cscript file.vbs

David
Old 27 May 2003, 05:02 PM
  #9  
rik1471
Scooby Regular
Thread Starter
 
rik1471's Avatar
 
Join Date: Nov 2001
Posts: 4,788
Likes: 0
Received 0 Likes on 0 Posts
Post

Thanx
Old 27 May 2003, 07:15 PM
  #10  
David_Wallis
Scooby Regular
 
David_Wallis's Avatar
 
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like on 1 Post
Post

no probs
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
blackieblob
ScoobyNet General
4
01 October 2015 11:37 AM
yabbadoo4
ScoobyNet General
11
30 September 2015 10:33 PM
Nick_Cat
Computer & Technology Related
2
26 September 2015 08:00 AM
Littleted
Computer & Technology Related
0
25 September 2015 08:44 AM



Quick Reply: Dos Batch File Help



All times are GMT +1. The time now is 06:39 AM.