How do I make this Batch run as Administrator by default?

Page 2 of 3 FirstFirst 123 LastLast

  1. Posts : 48
    Windows XP SP3
    Thread Starter
       #11

    Tookeri said:
    Your example has a space between / and W which won't work. It should be:
    start /W C:\ETKA\PROG\EtStart.exe "C:\ETKA\PROG\ETKA_VW.INI"
    Maybe I posted with a space but actually, the behavior I describe is the same without a space.

    Tookeri said:
    Because you want the program EtStart.exe to run with an old system date, right? And when that program is closed you want to reset the date to todays date?
    Yes to both

    Tookeri said:
    An alternative to inserting start /W is to insert a pause after launching EtStart.exe
    Code:
    C:\ETKA\PROG\EtStart.exe "C:\ETKA\PROG\ETKA_VW.INI"
    echo When EtStart.exe has been closed, press any key to Reset System Date back to Todays Date....
    pause
    date %CURDATE%
    Then it would be up to you know when EtStart.exe has been closed, and you would have to "press any key" in the command window so the batch continues and resets the system date.
    This works exactly as you describe.

    Tookeri said:
    But the start /W is better because it automatically keeps track of when EtStart.exe is closed. Or you could use both start /W and the pause.
    I tried both and it works but not without PAUSE. So because it does not work with start /W alone start /W becomes redundant with or without a space.

    Tookeri said:
    As for the shortcut and administrator, go to tab "Shortcut" in the properties instead of Compatibility, click button "Advanced", then check the "Run as administrator" checkbox.
    This worked. Just a pity I can't get the scipt to work with start /W
      My Computer


  2. Posts : 1,049
    Windows 7 Pro 32
       #12

    Ok, but at least it works with PAUSE so you should be fine with only that. Yes, the start /w is redundant in that case.

    This is just a guess: maybe start /w doesn't work with this specific program EtStart.exe. As the name of it suggests(the word "start" included it the name) maybe it's used only to start another program and then immediately terminate EtStart.exe? That would explain why it's not working.

    For example, if I try to run notepad in a similar way, in this case started through explorer.exe then start /w doesn't work anymore.

    start /w explorer.exe %windir%\system32\notepad.exe

    (the path was required for notepad.exe to be started through explorer.exe)
      My Computer


  3. Posts : 48
    Windows XP SP3
    Thread Starter
       #13

    Tookeri said:
    For example, if I try to run notepad in a similar way, in this case started through explorer.exe then start /w doesn't work anymore.

    start /w explorer.exe %windir%\system32\notepad.exe

    (the path was required for notepad.exe to be started through explorer.exe)
    I didn't quite (yet) understand this or the relevance

    Tookeri said:
    Ok, but at least it works with PAUSE so you should be fine with only that. Yes, the start /w is redundant in that case.

    This is just a guess: maybe start /w doesn't work with this specific program EtStart.exe. As the name of it suggests(the word "start" included it the name) maybe it's used only to start another program and then immediately terminate EtStart.exe? That would explain why it's not working.
    thanks. yes I think are right.
    Last edited by dav1129; 01 Dec 2014 at 19:24.
      My Computer


  4. Posts : 1,049
    Windows 7 Pro 32
       #14

    Sure, but I don't think that information will be helpful, unless it works with specifying that program in the start /w command instead of EtStart.exe

    Either way you'll be fine with only the PAUSE command too.
      My Computer


  5. Posts : 48
    Windows XP SP3
    Thread Starter
       #15

    Tookeri said:
    Sure, but I don't think that information will be helpful, unless it works with specifying that program in the start /w command instead of EtStart.exe

    Either way you'll be fine with only the PAUSE command too.
    it appears the program in the script starts another and once the other has started, it closes which explains why the batch file reset the system date immediately. so the program directory looks like this



    I never quite understood why there are so many ' PROG' directory.

    ETstart.exe is in PROG. the contents of PROG are different from PROG1 and PROG2. I never understood quite how the directories work but the updating process downloads updates to TEMP folder and I think, then updates one PROG directory and maybe modifies shortcuts and INI files (to include update level) and the next update, updates the other PROG directory and so forth. Not sure the reason for this.

    not being official you can't just download updates from official servers - you have to find them usually where you find the programs.

    anyway, I only use this (hacked) program for my own car which is 1999, or DIY interests. updates have stopped being relevant except perhaps for deletions for my car, so I have no need really to update so stopped updating the program.

    this is the reason for the batch file - to get around the program thinking it is out-of-date.

    once started etstart.exe does close and leaves ETKA7.exe running. ETKA7.exe (presently) is in the PROG1 directory.

    so can I modify the batch file to reflect this? remember reading the INI file is somehow involved is properly starting the program. the INI file tells the program which brands (AUDI SEAT SKODA VW) to load - I deleted the DATA for all but VW and have modified the INI to reflect this - this INI file I think also has the update level which the programs checks against the system date.
      My Computer


  6. Posts : 48
    Windows XP SP3
    Thread Starter
       #16

    Tookeri said:
    Sure, but I don't think that information will be helpful, unless it works with specifying that program in the start /w command instead of EtStart.exe

    Either way you'll be fine with only the PAUSE command too.
    okay thanks. so I have just substituted ETKA7.exe for Etstart.exe and modified the path, so that the batch now reads:

    Code:
    ECHO OFF
    CLS
    :MENU
    ECHO.
    ECHO ....................................... ........
    ECHO PRESS 1 to select your task, or 2 to EXIT.
    ECHO ....................................... ........
    ECHO.
    ECHO 1 - Launch C:\ETKA\PROG1\Etka7.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.
    date 01-01-2012
    echo Launching Program........Please Wait
    echo.
    START /W C:\ETKA\PROG1\Etka7.exe "C:\ETKA\PROG\ETKA_VW.INI"
    echo Resetting System Date back to Todays Date....Please Wait
    date %CURDATE%
    and it seems to work and do as it should without PAUSE i.e. when I close the program which is actually ETKA7.exe the batch automatically resets the system date and closes the CMD window. PERFECT!

    I don't why the Etstart.exe exists then. maybe something to with how the program updates and keeps 2 copies of the PROG* directory.

    anyway seems all's well that ends well. thanks for your help and patience.
      My Computer


  7. Posts : 2
    windows xp 32bits
       #17

    current date


    Hi mate,

    your batch file is fantastic and is exactly the work around i was looking for. However, it fails to reset the current date automatically upon leaving and prompts me to enter it manually ...any idea Why ? i ve copied and pasted your code and saved it as a batch file. I am running XP 32, so i don t have any run as administrator option, although logged on as one.

    thanks for your help
      My Computer


  8. Posts : 48
    Windows XP SP3
    Thread Starter
       #18

    hugo1111 said:
    Hi mate,

    your batch file is fantastic and is exactly the work around i was looking for. However, it fails to reset the current date automatically upon leaving and prompts me to enter it manually ...any idea Why ? i ve copied and pasted your code and saved it as a batch file. I am running XP 32, so i don t have any run as administrator option, although logged on as one.

    thanks for your help
    were you addressing me? if so, I started the thread because I needn't help myself. This is all a little beyond me although I did ultimately, get batch file together which worked. Trouble is I deleted the program because I want to upgrade it and never did. I'll see if I can find the batch file.......

    Code:
    ECHO OFF
    CLS
    :MENU
    ECHO.
    ECHO ....................................... ........
    ECHO PRESS 1 to select your task, or 2 to EXIT.
    ECHO ....................................... ........
    ECHO.
    ECHO 1 - Launch C:\ETKA\PROG1\Etka7.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.
    date 01-01-2012
    echo Launching Program........Please Wait
    echo.
    START /W C:\ETKA\PROG1\Etka7.exe "C:\ETKA\PROG\ETKA_VW.INI"
    echo Resetting System Date back to Todays Date....Please Wait
    
    date %CURDATE%
    This batch file above worked for me. It reset the system date (to earlier one, which allowed my program to run without recent updates), and then start the program. The DOS command window stays open and when the desired program was closed, reset the system date.

    I am not sure any more how I got this to work for me but if it works for you, great. Of course, you will have to swap the executable. If it doesn't work as is, you'll have to try some trial and error and learn a little DOS yourself.
      My Computer


  9. Posts : 2
    windows xp 32bits
       #19

    Hi David,

    yes the message was for you. It works fine , only the command date %curdate% doesn t automatically set the current date back . it asks me to enter manually mm-dd-yy. Not the end of the world as it enables to use EKTA without being reminded its out of date. If it could put it back automatically, it would be great.

    I simply copied all your command lines so it s odd that it works for you and not for me.

    cheers

    hugo
      My Computer


  10. Posts : 48
    Windows XP SP3
    Thread Starter
       #20

    hugo1111 said:
    Hi David,

    yes the message was for you. It works fine , only the command date %curdate% doesn t automatically set the current date back . it asks me to enter manually mm-dd-yy. Not the end of the world as it enables to use EKTA without being reminded its out of date. If it could put it back automatically, it would be great.

    I simply copied all your command lines so it s odd that it works for you and not for me.

    cheers

    hugo
    Oh, I see you're using it with ETKA too! I was using this script with ETKA 7.3 Plus. But recently downloaded, 7.4. I forgot to try installing it to see if it is better. I was already using Windows Seven though so if it didn't work for you you're using XP, then I suspect the SYNTAX might be different for XP you could google it and see.
      My Computer


 
Page 2 of 3 FirstFirst 123 LastLast

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 18:06.
Find Us