parse %date% as text in batch
-
Hello, Im trying to write a batch file which creates another batch file..... @echo off echo if %date%==03-10-2009 pause>>D:\hello.bat output is if 02-10-2009==03-10-2009 pause ....................................... the problem is that instead of taking %date% as text it's writing date on hello.bat..... i even tried with ^ @echo off echo if %^date^%==03-10-2009 pause>>D:\hello.bat now in this case the output is if ==03-10-2009 pause but when the same command echo if %^date^%==03-10-2009 pause>>D:\hello.bat i give from cmd instead running bat it's giving correct format in hello.bat if %date%==03-10-2009 pause.... i want this %date% to be printed as it is not as value in hello.bat through a batch file.
-
Hello, Im trying to write a batch file which creates another batch file..... @echo off echo if %date%==03-10-2009 pause>>D:\hello.bat output is if 02-10-2009==03-10-2009 pause ....................................... the problem is that instead of taking %date% as text it's writing date on hello.bat..... i even tried with ^ @echo off echo if %^date^%==03-10-2009 pause>>D:\hello.bat now in this case the output is if ==03-10-2009 pause but when the same command echo if %^date^%==03-10-2009 pause>>D:\hello.bat i give from cmd instead running bat it's giving correct format in hello.bat if %date%==03-10-2009 pause.... i want this %date% to be printed as it is not as value in hello.bat through a batch file.
did you try escaping your % signs, by doubling them? BTW: do you really think this problem is Vista/Win7 specific? :)
Luc Pattyn
Local announcement (Antwerp region): Lange Wapper? Neen!
-
did you try escaping your % signs, by doubling them? BTW: do you really think this problem is Vista/Win7 specific? :)
Luc Pattyn
Local announcement (Antwerp region): Lange Wapper? Neen!
Thnx alot i got it :) i didnt use %%date%% instead i was trying ^%date^%.....