pankajarora
Programmer
Hi,
I am new to VBScripting and so need some help. Following is the (runas.vbs) script that I am using to use the RunAs command in command prompt:
Option explicit
Dim oShell, k, strarg
Const PASSWORD = "Password123~"
set oShell= Wscript.CreateObject("WScript.Shell")
WScript.Sleep 500
oShell.run ("RunAs /noprofile /user:%computername%\postgres " & Chr(34) & "cmd /c\" & Chr(34) & WScript.Arguments(0) & "\" & Chr(34) & Chr(34))
WScript.Sleep 1000
For k=1 To Len(PASSWORD)
WScript.Sleep 200
oShell.SendKeys Mid(PASSWORD,k,1)
Next
Wscript.Quit
I call this vbscript from a batch file. When this vbs is executed while running the batch file, it opens another command prompt on the top of the original one. I want to know if there is a way to hide the new command prompt window which gets opened by this vs so that it can run in the background and not show up.
Thanks
I am new to VBScripting and so need some help. Following is the (runas.vbs) script that I am using to use the RunAs command in command prompt:
Option explicit
Dim oShell, k, strarg
Const PASSWORD = "Password123~"
set oShell= Wscript.CreateObject("WScript.Shell")
WScript.Sleep 500
oShell.run ("RunAs /noprofile /user:%computername%\postgres " & Chr(34) & "cmd /c\" & Chr(34) & WScript.Arguments(0) & "\" & Chr(34) & Chr(34))
WScript.Sleep 1000
For k=1 To Len(PASSWORD)
WScript.Sleep 200
oShell.SendKeys Mid(PASSWORD,k,1)
Next
Wscript.Quit
I call this vbscript from a batch file. When this vbs is executed while running the batch file, it opens another command prompt on the top of the original one. I want to know if there is a way to hide the new command prompt window which gets opened by this vs so that it can run in the background and not show up.
Thanks