0

I'm struggling with defining a single bat file which consists of some commands that need to run in admin mode and other in regular mode. (part 1:admin, part 2: normal, part 3: admin)

The closest solution I could think of is to define one files that call 3 different files. (The first part of file Init1, Init3 define admin mode which is copied from https://sites.google.com/site/eneerge/scripts/batchgotadmin)

Unfortunately it seems that the files are not executed one by one and I don't reach Init3.

I Defined the following files:

MainInit.bat

call Init1

call Init2

call Init3

Init1.bat:

// code from How to request Administrator access inside a batch file

echo "1"

exit

Init2.bat:

echo "2"

exit

Init3.bat:

// code from How to request Administrator access inside a batch file

echo "3"

exit
Community
  • 1
  • 1
John
  • 1
  • you can achieve that with `RUNAS` or `SCHTASKS` commands but it will mean to store somewhere the admin password. The pass/script can be obfuscated but still will easy to get it. – npocmaka Feb 07 '17 at 15:55
  • 5
    Why can't you just run all 3 commands as an admin? – DavidPostill Feb 07 '17 at 17:21

0 Answers0