- Jun 14, 2008
- 55
- 0
- 66
Hi, I need a bat file to:
START
1. Read system date
2. Store read date in variable X or if impossible in text file.
3. Change system date to 2008-08-02 (format is YMD)
4. Run command sc start myservice (start windows service)
5. Read the stored date from variable X or text file.
6. Set system time to variable X
7. (optional) remove file where variable was stored if a file was used.
END
Any hep would be appreciated.
I found the read data example but don't know how to store it , then call it , and set time etc.
-----------------------------------------
:: Get system's current date into multiple variables
@echo off
if "%1"=="GoTo" goto %2
echo e180 BF 07 01 B4 04 CD 1A E8 02 00 89 CA E8 00 00> %temp%.\t1.src
echo e18F 86 D6 88 D0 D4 10 0D 30 30 86 C4 AB 47 C3>> %temp%.\t1.src
for %%? in (rip 180 g w q) do echo %%?>> %temp%.\t1.src
echo SET %%1=XX XX XX XX> %temp%.\t2.bat
DEBUG %temp%.\t2.bat < %temp%.\t1.src > nul
call %temp%.\t2.bat _
%0 GoTo parse %_% MM DD YC YY
arse
set %7=%3
shift
if not "%7"=="" goto parse
for %%? in (t1.src t2.bat) do del %temp%.\%%?
set _=
--------------------------------------------
taken from http://www.geocities.com/leopignataro86/batchfiles/#25
START
1. Read system date
2. Store read date in variable X or if impossible in text file.
3. Change system date to 2008-08-02 (format is YMD)
4. Run command sc start myservice (start windows service)
5. Read the stored date from variable X or text file.
6. Set system time to variable X
7. (optional) remove file where variable was stored if a file was used.
END
Any hep would be appreciated.
I found the read data example but don't know how to store it , then call it , and set time etc.
-----------------------------------------
:: Get system's current date into multiple variables
@echo off
if "%1"=="GoTo" goto %2
echo e180 BF 07 01 B4 04 CD 1A E8 02 00 89 CA E8 00 00> %temp%.\t1.src
echo e18F 86 D6 88 D0 D4 10 0D 30 30 86 C4 AB 47 C3>> %temp%.\t1.src
for %%? in (rip 180 g w q) do echo %%?>> %temp%.\t1.src
echo SET %%1=XX XX XX XX> %temp%.\t2.bat
DEBUG %temp%.\t2.bat < %temp%.\t1.src > nul
call %temp%.\t2.bat _
%0 GoTo parse %_% MM DD YC YY
set %7=%3
shift
if not "%7"=="" goto parse
for %%? in (t1.src t2.bat) do del %temp%.\%%?
set _=
--------------------------------------------
taken from http://www.geocities.com/leopignataro86/batchfiles/#25