I am trying to create a batch file to parse a directory Z:\ (not including sub folders) which is a mapped network drive to give all folders that name includes “COMPANY_*” and output those folder names with the the full path to a text file.
The text file will be saved to a program folder location which is referenced when you run the program.
For example
Dir:
- Z:\Company_001
- Z:\def
- Z:\Comapny_002
- Z:\Company_101
Text file:
- Z:\Company_001
- Z:\Company_002
- Z:\Company_101
I started to have a go but dont know what I am doing and need to run this batch on 10 computers so do not want to cause any problems.
dir "Z:\" /b >d:\test.txt
FOR /F "delims=" %%a in (test.txt) do @echo Z:\%%a>>output.txt
del "d:\test.txt"
start C:\Windows\System32\notepad.exe "d:\output.txt"
pause
You can add a call to open the file with notepad if you want to. What you have now would work.