New
#1
How do I make this Batch run as Administrator by default?
I haven't looked back since recently and initially reluctantly upgrade from XP to Windows 7.
Just loving it now. But I have a small BATCH file problem.
I found and adapted a batch file (see below) to start the VAG parts catalogue program after first resetting the system date but then resetting the system date back.
This is because the program checks the system date against the last program updates installed. If too much time has elapsed, the program will not be able to progress beyond the splash screen.
Starting the program is this way is fine for me as it is for personal use and I am interested only in my own vehicle which is old enough now that is not affected by updates except perhaps in the rare instance where parts are deleted or superseded.
What I would like to know is how to make the BATCH file (shortcut) run as administrator as otherwise the BATCH file cannot change the system date.
ECHO OFF
CLS
:MENU
ECHO.
ECHO ....................................... ........
ECHO PRESS 1 to select your task, or 2 to EXIT.
ECHO ....................................... ........
ECHO.
ECHO 1 - Launch C:\ETKA\PROG\EtStart.exe "C:\ETKA\PROG\ETKA_VW.INI"
ECHO 2 - Exit
ECHO.
SET /P M=Type 1, 2, then press ENTER:
IF %M%==1 GOTO PROGRAM
IF %M%==2 GOTO RESETDATE
:PROGRAM
FOR /F "TOKENS=1* DELIMS= " %%A IN ('DATE/T') DO SET CURDATE=%DATE%
COLOR 4f
echo Setting System date to 01-01-2012
echo.
runas /user:Administrator date 01-01-2012
echo Launching Program........Please Wait
echo.
C:\ETKA\PROG\EtStart.exe "C:\ETKA\PROG\ETKA_VW.INI"
echo Resetting System Date back to Todays Date....Please Wait
date %CURDATE%
PS If the script looks complicated such that I should know the answer to my own question, I didn't write it, only adapted it and found that but for needing to run as administrator, it worked.
Yes as it turns out, once successfully started the programs checks the system date again when loading a VIN data file (which is used to cross check against VIN first). So whilst this BATCH file is slick and works well, is there a way to only change the system date when the program actually exits?
Last edited by dav1129; 15 Nov 2014 at 02:50.