How do I ran a script after I open a command window using the below script?
Set objSh = CreateObject("Shell.Application")
objSh.ShellExecute "cmd.exe", "uac" , "", "runas", 1
For example, how do I run ipconfig
as an admin using the above script?
If you specify the
/c
switch, thencmd.exe
will carry out the specified command and then terminate.So, for example:
Alternatively, you could use the
/k
switch, which works exactly the same way, except it keeps the command prompt on the screen once your command finishes executing.