Page 1 of 1

echo %something% >> name.bat becomes blank space

Posted: 11 Apr 2010 21:36
by aseventhmindset
I am trying to make a batch file that will make another batch file. It works up until the point where I enter:

echo if %command%==Hide goto :Hide >> "%homedrive%\Documents and Settings\%username%\desktop\File Hider\FileHider.cmd"
echo if %command%==hide goto :Hide >> "%homedrive%\Documents and Settings\%username%\desktop\File Hider\FileHider.cmd"
echo if %command%==Unhide goto :Unhide >> "%homedrive%\Documents and Settings\%username%\desktop\File Hider\FileHider.cmd"
echo if %command%==unhide goto :Unhide >> "%homedrive%\Documents and Settings\%username%\desktop\File Hider\FileHider.cmd"
echo if %command%==Exit goto :End >> "%homedrive%\Documents and Settings\%username%\desktop\File Hider\FileHider.cmd"
echo if %command%==exit goto :End >> "%homedrive%\Documents and Settings\%username%\desktop\File Hider\FileHider.cmd"

The batch file "File Hider.cmd" has a blank space where it should say "%command%". I know why this happens, but I was wondering if there is a way to work around this.

Re: echo %something% >> name.bat becomes blank space

Posted: 12 Apr 2010 04:17
by jeb
hi aseventhmindset,

Code: Select all

echo if %command%==Hide goto :Hide >> "%homedrive%\Documents and Settings\%username%\desktop\File Hider\FileHider.cmd"


Will result to
FileHider.cmd

Code: Select all

if ==Hide goto :Hide


You should change it to

Code: Select all

echo if %%command%%==Hide goto :Hide >> "%homedrive%\Documents and Settings\%username%\desktop\File Hider\FileHider.cmd"


jeb

Re: echo %something% >> name.bat becomes blank space

Posted: 12 Apr 2010 19:14
by aseventhmindset
Thanx.