set date

  • Thread starter Thread starter jaime richmond
  • Start date Start 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
 
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
 
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
 
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
 
Back
Top