Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


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

30 Nov 2014   #11
dav1129

Windows XP SP3
 
 

Quote   Quote: Originally Posted by Tookeri View Post
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.

Quote   Quote: Originally Posted by Tookeri View Post
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

Quote   Quote: Originally Posted by Tookeri View Post
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.

Quote   Quote: Originally Posted by Tookeri View Post
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.

Quote   Quote: Originally Posted by Tookeri View Post
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 System SpecsSystem Spec
.
01 Dec 2014   #12
Tookeri

Windows 7 Pro 32
 
 

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 System SpecsSystem Spec
01 Dec 2014   #13
dav1129

Windows XP SP3
 
 

Quote   Quote: Originally Posted by Tookeri View Post
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

Quote   Quote: Originally Posted by Tookeri View Post
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.
My System SpecsSystem Spec
.

01 Dec 2014   #14
Tookeri

Windows 7 Pro 32
 
 

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 System SpecsSystem Spec
01 Dec 2014   #15
dav1129

Windows XP SP3
 
 

Quote   Quote: Originally Posted by Tookeri View Post
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 System SpecsSystem Spec
01 Dec 2014   #16
dav1129

Windows XP SP3
 
 

Quote   Quote: Originally Posted by Tookeri View Post
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 System SpecsSystem Spec
09 Oct 2015   #17
hugo1111

windows xp 32bits
 
 
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 System SpecsSystem Spec
09 Oct 2015   #18
dav1129

Windows XP SP3
 
 

Quote   Quote: Originally Posted by hugo1111 View Post
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 System SpecsSystem Spec
09 Oct 2015   #19
hugo1111

windows xp 32bits
 
 

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 System SpecsSystem Spec
09 Oct 2015   #20
dav1129

Windows XP SP3
 
 

Quote   Quote: Originally Posted by hugo1111 View Post
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 System SpecsSystem Spec
Reply

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




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
How to run a batch , .bat, flle as administrator
I run a batch file from the Windows scheduler and get an error 5, 'access denied'. If i run the batch file as administrator I have access and everything is OK except I must answer the UAC popup. The question is "How can I run the batch file from the scheduler with admin privileges and NOT have to...
General Discussion
Execute Program in Batch File As Administrator (Or Other Solution)
We use a program called TFC.exe (Temp File Cleaner - addpcs.com) to wipe all sorts of temp files off a computer on a monthly basis. The older version was a standalone .exe that users used to execute from a a folder on a server. The newer version is actually installed on each user's PC. If...
General Discussion
shutdown in batch file requires Administrator
Hi all, I've been using GFI Backup 2009 for backups for a while, it does everything I want, and sends email reports after backup is complete. One of its features is to shutdown the computer after a backup, this rarley works, as it wont shutdown if a program is already running, including GFI...
General Discussion
Batch File on USB fails when Ran As Administrator
I am new to this site so please excuse any lack of etiquette I may show. I have recently built a .bat files to perform a large number of configuration changes needed for a Win7 or Win8 workstation to function properly on my network. The .bat file obviously needs to be ran with elevated...
Software
How to always run batch file as administrator?
I've made a batch file, but i don't know how to make it to always run as administartor. In .bat's file properties the option "always run as administartor" is grayed out. I have to right click it and then choose "run as administartor" from context menu. But i don't want to do it every time because...
General Discussion
batch files - run as administrator
I am a software developer (dot net). Until recently I did all my work in the XP environment. I developed a utility library that goes into the global assembly cache. In the XP world this was easy. I write some .bat files that called the gacutil.exe and passed it the appropriate parameters. ...
General Discussion


Our Sites

Site Links

About Us

Find 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 19:22.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App