1.

Solve : Having problem with %%?

Answer»

Hi i want to make a batch file (timer creater.bat) as shown:
Code: [Select]echo off
echo echo off >timer.bat
echo MSG * today is %date% %time% >>timer.bat
echo exit >>timer.bat
Well this is hard to explain, I want to CREATE a new batch file that is timer.bat
and i want the command %date% in my new batch but not the information about the %date% like 04/19/2010 monday.
Know what i mean? 
So my new batch (timer.bat) will look like this:
Code: [Select]echo off
msg * today is %date% %time%
exit
But not this:
Code: [Select]echo off
msg * today is 04/19/2010 Mon 11:20:32.68
exit
Make sense?
If yes, please help!Try this:
Code: [Select]echo off

(
echo echo off
echo msg * today is %%date%% %%time%%
echo exit
)>timer.bat

Note the doubling of %% so that they are treated as LITERALS.

Quote from: T.C. on April 18, 2010, 09:56:14 PM

Try this:
Code: [Select]echo off

(
echo echo off
echo msg * today is %%date%% %%time%%
echo exit
)>timer.bat


Note the doubling of %% so that they are treated as literals.


Well THANKS It WORK Great!


Discussion

No Comment Found