a problem with a batch cmd

reble

Honorable
Nov 14, 2013
62
0
10,640
I am trying to make a bat file to put on a cd that when the cd is put in and the bat file is run, it will make a directory on the hard drive then copy the DOS game from the cd and past the game to the directory that was made on the hard drive. I am making this cd for a friend and it is a new learning experience for me.
I got the bat file partly working. I am having a sync text error in the copy cmd line that I can't figure out. I have a few read/write DVD's. I am using the 1 of the read/write DVD's as a test bead instead of using up all my blank DVD's and CD's until I get all the bugs out of the bat file. The DVD is formated. Bellow is the bat file as it stands now and a screen capture of the DOS cmd box. I would be very grateful if someone can help me work out the bugs. The dir names in the copy line are for test purposes only. Once the bat file is working right I will put in the real dir's. The test dir names are so I don't screw up my hard drive during testing.


@echo off
echo WELCOME TO WOLF3D COPYER.
echo This BAT file will make the directory and copy the game to the HD.
pause &rem [this pause is here because the echo lines above won't show when the bat file runs without the pause]
mkdir C:\dgames\dgames\wolf3d-
cd /d "%~dp0"
cls
echo Your %~d0 drive.
cd %~d0
dir
cd temp &rem [the bat file works fine to this point]
COPY "Cd %~d0\temp\test file.doc" "C:\dgames\dgames"
rem [I am having a sync error in the copy line]

pause &rem [the pause is here to keep the dos cmd window open to take a screen capture picture

The screen capture can be seen at this link https://www.dropbox.com/s/uca8eyovsy90b5a/bat%20file.jpg?dl=0
 
Thanks RGD I new it was just a syntax error in the line. I just couldn't figure it out.
By the way how do I change the echo lines bellow so they show up without the pause? Without the pause the echo lines don't show when the bat file is run.
------------------------
@echo off
echo WELCOME TO WOLF3D COPYER.
echo This BAT file will make the directory and copy the game to the HD.
----------------------


 
RGD I ran into an other syntax error. I am trying to copy the "Wolf3d.bat" (that starts the game after it is installed on the hd) to the desktop. This copy cmd line isn't working. Something about the destination path is wrong. My path to my desktop is C:\users\steve\desktop. His is naturally different. What is the generic string to replace the user name with?

copy "wolf3d.bat" "%HOMEPATH%\desktop"



 
I don't know what happened to the last post that I just submited a few minutes ago. Saying that I just figured out the last syntax error. Based on the info that RGD gave me about the 1st copy string. The 2nd copy string just needed a minor adjustment to make it work.
 
After about 14 hours of work I finely got the last syntax bug out of the batch file. The last bug was the xcopy string to copy the game it self and all the games sub directorys from the cd to the hard drive. The final string is [XCOPY "\games*" "C:\dgames\dgames" /e]. I went through many hours of looking at the xcopy cmd syntax switchs at lifewire.com/xcopy-command-2618103. Now that is done I will do the main menu and burn the cd after a few hours of sleep. It was real learning experience. Thats how I learn new things, hands on and getting my hands durty.