|
Answer» I've written a batch file that works fine when each command is pasted into CMD but when I double click the batch file it just loops half WAY through. When I run the batch file it stops halfway through.
I found that the variable %CMDCMDLINE% is the point of the problem but I haven't been able to fix this.
Here's my batch file:
ECHO Step 1 ECHO Create Destination Folder for Executables cd %PROGRAMFILES% md "Symantec Game Pack"
ECHO Step 2 ECHO Create Destination Folder for Shortcuts cd "%ALLUSERSPROFILE%\Start Menu\Programs\" md "Symantec Game Pack"
(Steps 1 and 2 WORK fine)
ECHO Step 3 ECHO Copy Executable Files %CMDCMDLINE% cd "Game Files" copy * "%PROGRAMFILES%\Symantec Game Pack"
(The 3rd line in this step is the issue. When I run the batch out of the CMD by typing in the batch NAME I get this line:
"cmd.exe" /k "cd C:\Symantec Game Pack Installer"
If I use %CMDCMDLINE% in the line-by-line process it works normally.)
ECHO Step 4 ECHO Copy Shortcuts %CMDCMDLINE% cd "Shortcuts" copy * "%ALLUSERSPROFILE%\Start Menu\Programs\Symantec Game Pack\"
ECHO Step 5 ECHO Exit Script %CMDCMDLINE%
Any ideas?OK, I've found that %CMDCMDLINE% returns the path where CMD is started and not the folder of the batch file.I re-wrote the batch file using Xcopy RATHER than the longer approach. Feel free to delete this thread.Why Delete?
It gave me a good idea.
|