Run batch "not as administrator" -


my main batch runs several small batch files administrator. need run current user exe il start says "dont run admin"

i have tried in mybatch1.bat runas /profile /user:%username% start /wait /min mybatch2.exe

this gives me list of "runas"available commands

read entire runas /?; excerption follows:

runas usage:  runas [ [/noprofile | /profile] [/env] [/savecred | /netonly] ] /user:<username> program  ...     program         command line exe.  see below examples  examples: > runas /noprofile /user:mymachine\administrator cmd > runas /profile /env /user:mydomain\admin "mmc %windir%\system32\dsa.msc" > runas /env /user:user@domain.microsoft.com "notepad \"my file.txt\""  note:  enter user's password when prompted. 
  • read examples above multi-word program usage .
  • note program should command line exe start internal command.

hence, runas /profile /user:%username% "start \"\" /wait /min notepad.exe" leads following error (fyi, system cannot find file start):

runas error: unable run - start "" /wait /min notepad.exe 2: system cannot find file specified. 

we try runas /profile /user:%username% "cmd /c start \"\" /wait /min notepad.exe". command launch notepad following batch script
- will not wait terminating notepad
- , displays eof: 32197368.bat message
- while cmd /c waits terminating notepad:

@echo off >nul setlocal enableextensions runas /profile /user:%username% "cmd /c start \"\" /wait /min notepad.exe" echo eof: %~nx0 

Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -