set date

J

jaime richmond

im looking for a way to capture the current date in a batch file change the
pc date run an older non 2k program and then change it back when finished.

i had a program that worked great in win98 but doesnt seem to work in win2k
any ideas.

@echo off
echo @prompt if '%%%%2==' %%%%0 $D$_date %%%%2 > %temp%.\~tmpA.bat
%comspec% /e:2048 /c %temp%.\~tmpA.bat > %temp%.\~tmpB.bat
date 12/31/99
start /w pos.exe % Just in case it's a Win32 prog %
for %%v in (%temp%.\~tmpB.bat del) do call %%v %temp%.\~tmp?.bat
 
M

Matthias Tacke

jaime said:
im looking for a way to capture the current date in a batch file change the
pc date run an older non 2k program and then change it back when finished.

i had a program that worked great in win98 but doesnt seem to work in win2k
any ideas.

@echo off
echo @prompt if '%%%%2==' %%%%0 $D$_date %%%%2 > %temp%.\~tmpA.bat
%comspec% /e:2048 /c %temp%.\~tmpA.bat > %temp%.\~tmpB.bat
date 12/31/99
start /w pos.exe % Just in case it's a Win32 prog %
for %%v in (%temp%.\~tmpB.bat del) do call %%v %temp%.\~tmp?.bat
If that pc is networked, I'd try to get the actual date and time back
from another pc.

@echo off
net time \\pc1 /set /Yes &&exit /b 0
net time \\pc2 /set /Yes &&exit /b 0
net time \\pc3 /set /Yes &&exit /b 0
echo No time source found.
pause
 
D

Dean Wells [MVP]

for /f "tokens=2" %%d in ('date /t') do set realDATE=%%d
date 12/31/99
start /w pos.exe % Just in case it's a Win32 prog %
date %REALDATE%

HTH
 
J

jaime richmond

thanks but no this pc is not networked .

Matthias Tacke said:
If that pc is networked, I'd try to get the actual date and time back
from another pc.

@echo off
net time \\pc1 /set /Yes &&exit /b 0
net time \\pc2 /set /Yes &&exit /b 0
net time \\pc3 /set /Yes &&exit /b 0
echo No time source found.
pause
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top