| 1. |
Solve : What did I do wrong?? |
|
Answer» I have a bunch of joke programs on my computer (NAV doesn't like it, the old codger) and some are customizable with the command prompt. I'm writing a batch file to execute these programs with these special functions. create You may have missed a few, also create needs a colon in front. I presume that bombtemp and bombtemp2 are meant to be two different files. Code: [Select]:create REM - creates the batch file and writes it ECHO @echo off > bombtemp.bat ECHO cd \Documents and Settings\Timothy\Start Menu\Programs\Startup\ >> bombtemp.bat ECHO @echo off > bombtemp2.bat ECHO cd \Documents and Settings\Timothy\Desktop\Desktop Games\ >> bombtemp2.bat ECHO bomb.exe '%choice%' >> bombtemp2.bat ECHO cd \utilities >> bombtemp2.bat call bombtemp.bat del bombtemp.bat 8-)OK, I revised that code. My intention is as follows: Write a "bombtemp.bat" batch file, which includes instructions to create another batch file in the startup folder, which will execute the code. Ideally, I should have the following in the end: In C:\Utilities\bombtemp.bat: Code: [Select]cd \Documents and Settings\Timothy\Start Menu\Programs\Startup\ @echo off > bombtemp2.bat cd \Documents and Settings\Timothy\Desktop\Desktop Games\ >> bombtemp2.bat bomb.exe '%choice%' >> bombtemp2.bat cd \utilities >> bombtemp2.bat In C:\Documents and Settings\Timothy\Start Menu\Programs\Startup\bombtemp2.bat: Code: [Select]@echo off cd \Documents and Settings\Timothy\Desktop\Desktop Games\ bomb.exe '%choice%' cd \utilities And that's it. I used this batch file to achieve this: Code: [Select]@ECHO OFF cls ECHO This batch file will simulate a bombed program. It will place it in the startup ECHO folder so it will run at next startup. :begin set choice= set /p choice=Choose program to bomb: IF EXIST %choice% GOTO create ECHO Sorry, the specified program does not exist. GOTO begin :create REM - creates the batch file and writes it ECHO @echo off > bombtemp.bat ECHO cd \Documents and Settings\Timothy\Start Menu\Programs\Startup\ >> bombtemp.bat ECHO @echo off > bombtemp2.bat >> bombtemp.bat ECHO cd \Documents and Settings\Timothy\Desktop\Desktop Games\ >> bombtemp2.bat >> bombtemp.bat ECHO bomb.exe '%choice%' >> bombtemp2.bat >> bombtemp.bat ECHO cd \utilities >> bombtemp2.bat >> bombtemp.bat call bombtemp.bat What I got was "bombtemp.bat" in the startup folder with this code: Code: [Select]@echo off cd \Documents and Settings\Timothy\Start Menu\Programs\Startup\ @echo off cd \Documents and Settings\Timothy\Desktop\Desktop Games\ bomb.exe '"C:\Program Files\Opera\Opera.exe"' cd \utilities What the heck did I do wrong?Somewhere along the way this seems to have changed. In any case you need to escape certain characters to pass them thru a redirection: ^> should pass a single > to the output file ^>^> should pass a double >> to the output file You just gotta love the brains that came up with this stuff. |
|