• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

NT Batch Scripting

coughtryb

Member
I have a .txt file that contains a list of paths and directory names in the following format...

c:\users\john\gameinfo
c:\users\jane\gameinfo
c:\users\robert\gameinfo
(hundres more directories, all called gameinfo, but in different locations)

All I want to do is run RMDIR on each instance of 'gameinfo'. I am new to scripting but I know there has to be a way to do this. I have tried pipes and redirects without success. Any help would be appreciated.

Thanks friends!
Beni
 
This is easier to do in vbscript


try this code in a .vbs file, be sure to replace C:\file.txt with your text file
Dim fso

Set fso = CreateObject("Scripting.FileSystemObject")
Set oText = fs😵penTextFile("C:\file.txt", 1)

Do Until oText.AtEndofStream
str = oText.ReadLine()

fso.DeleteFolder(str)
Loop

 
Assuming every single line in this text file is a gameinfo directory that you want to delete:
*** Also note, "%%" is used in an actual batch file, but if you were to run this command directly from dos you would only use 1 "%" per occurance.

(you may also want to add the /s /q switches to rmdir depending on the occasion)
 
Back
Top