Reputation: 1
I have the following lines in a .bat file, when they are run in a command prompt they all work, but when I run the .bat file it gets to the first for loop and then ends. I am trying to re-produce the folder structure and then only copy the .pdf files to the new location. After which I want to then delete the existing folders and files.
Thanks!
@echo ON
Pause
cd D:\Projects\Staging
Pause
For /D %g in (*) DO mkdir "D:\Projects\Export\%g"
Pause
For /D %g in (*) DO copy "%g\*.pdf" "D:\Projects\Export\%g\"
Pause
For /D %g in (*) DO del "star dot star"
@echo off
Pause
Upvotes: 0
Views: 75
Reputation: 26160
in the command line you get the value of var g by typping %g
wheras in batch file you need double % %%g
Upvotes: 1