| Forum Home | ||||
| Press F1 | ||||
| Thread ID: 77250 | 2007-03-03 20:06:00 | What's wrong with my batch file? | pcuser42 (130) | Press F1 |
| Post ID | Timestamp | Content | User | ||
| 529735 | 2007-03-03 20:06:00 | Every time the batch file runs, it comes up with "Does C:\batch\:\Gruntz specify a file name or directory name on the target". I want to copy all files in C:\Games\Gruntz to the user's CD burner, which is why it asks for the CD drive letter. :help: This file will be distributed. @echo off set /p userinp=Enter your CD burner's drive letter. If you are not sure, enter D. DO NOT TYPE A COLON(:)! set userinp=%drive% echo Copying files... xcopy c:\games\gruntz "%drive%:\Gruntz" /f /s /e /t /r echo Finished. Press any key to exit. pause |
pcuser42 (130) | ||
| 529736 | 2007-03-03 20:16:00 | try xcopy c:\games\gruntz\ * etc |
beama (111) | ||
| 529737 | 2007-03-03 20:52:00 | Delete the set userinp=%drive% line. Then substitute userinp for %drive% in the xcopy line. HTH |
Tom McB (832) | ||
| 529738 | 2007-03-03 21:08:00 | New code: @echo off set /p userinp=Enter your CD burner's drive letter. If you are not sure, enter D. DO NOT TYPE A COLON(:)! echo Copying files... xcopy c:\games\gruntz "%userinp%:\Gruntz" /f /s /e /t /r echo Finished. Press any key to exit. pause |
pcuser42 (130) | ||
| 529739 | 2007-03-03 21:40:00 | Missed edit deadline. It works, but not when copying to the optical drive (which is what I want it to do). |
pcuser42 (130) | ||
| 529740 | 2007-03-03 21:44:00 | Use a burning program, like everyone else. Why make things difficult. When u dont have to. |
Speedy Gonzales (78) | ||
| 529741 | 2007-03-04 01:52:00 | The problem is that a name such as "Gruntz" can be a filename or a directory name. It is legal to copy multiple files to one filename. It is overwritten by each source file in turn, and you finish up with only the last file having that name. That's why it asks you. ;D If you give it "Gruntz/" the system will know that you intend all the source files to be put in that directory. That "/" will make the difference. (I'd add "/*.*" to the source part of the xcopy statement, too, though it's probably not essential). Your new version gets rid of the problem that you were not giving it the CD drive name. The first line got (e.g.) D into userinp. Then "userinp=%drive%" overwrote it with the value of the "drive" environment variable. That hadn't been given anything (so it was "") because your error message shows that "%userinp%:" has been evaluated as ":". |
Graham L (2) | ||
| 529742 | 2007-03-04 03:44:00 | I presume that cmd.exe cannot burn to a CD, as I try copying to drive D:, butr fails, and works perfectly on drive C:. | pcuser42 (130) | ||
| 529743 | 2007-03-04 03:53:00 | So now we've got the syntax correct we run into a semantic problem. :D DOS needed the MSCDEX extension code to read CDs, but that ability is probably included in the "XP DOS" versions; thinking about it, I doubt if there was ever any MS support for CD writing from DOS, so they probably won't have included the capability. :( |
Graham L (2) | ||
| 529744 | 2007-03-04 10:07:00 | If you format the CD into a Incd type of format then you can xcopy to to cd drive. | berryb (99) | ||
| 1 2 | |||||