Dos Batch File Help
#1
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??
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??
#4
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.
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.
#7
Scooby Regular
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
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
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
Trending Topics
#8
Scooby Regular
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
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
Copy and paste into notepad, save as "File.Vbs" or whatever..
then call from a batch file by doing
cscript file.vbs
David
Thread
Thread Starter
Forum
Replies
Last Post