i have this vbs
On Error Resume Next
dim WshShell,FSO
sUser="++++++"
sPass="+++++++"
sCmd="+++++++"
set WshShell = CreateObject("W Script.Shell")
set WshEnv = WshShell.Enviro nment("Process" )
WinPath = WshEnv("SystemR oot")&"\System3 2\runas.exe"
set FSO = CreateObject("S cripting.FileSy stemObject")
if FSO.FileExists( winpath) then
'wscript.echo winpath & " " & "verified"
else
wscript.echo "!! ERROR !!" & VBCRLF & "Can't find or verify " &
winpath &"." & VBCRLF & "You must be running Windows 2000 for this
script to work."
set WshShell=Nothin g
set WshEnv=Nothing
set FSO=Nothing
wscript.quit
end if
rc=WshShell.Run ("runas /user:" & sUser & " " & CHR(34) & sCmd &
CHR(34), 2, FALSE)
Wscript.Sleep 30 'need to give time for window to open.
WshShell.AppAct ivate(WinPath) 'make sure we grab the right window to
send password to
WshShell.SendKe ys sPass 'send the password to the waiting window.
set WshShell=Nothin g
set WshEnv=Nothing
set FSO=Nothing
wscript.quit
i have convert this to exe...ok...but if i run will open i window and
wait i password for the command runas -.-" while if i run this
in .vbs: wscript xxxx.vbs it work...
why?
tnx, Pietro
On Error Resume Next
dim WshShell,FSO
sUser="++++++"
sPass="+++++++"
sCmd="+++++++"
set WshShell = CreateObject("W Script.Shell")
set WshEnv = WshShell.Enviro nment("Process" )
WinPath = WshEnv("SystemR oot")&"\System3 2\runas.exe"
set FSO = CreateObject("S cripting.FileSy stemObject")
if FSO.FileExists( winpath) then
'wscript.echo winpath & " " & "verified"
else
wscript.echo "!! ERROR !!" & VBCRLF & "Can't find or verify " &
winpath &"." & VBCRLF & "You must be running Windows 2000 for this
script to work."
set WshShell=Nothin g
set WshEnv=Nothing
set FSO=Nothing
wscript.quit
end if
rc=WshShell.Run ("runas /user:" & sUser & " " & CHR(34) & sCmd &
CHR(34), 2, FALSE)
Wscript.Sleep 30 'need to give time for window to open.
WshShell.AppAct ivate(WinPath) 'make sure we grab the right window to
send password to
WshShell.SendKe ys sPass 'send the password to the waiting window.
set WshShell=Nothin g
set WshEnv=Nothing
set FSO=Nothing
wscript.quit
i have convert this to exe...ok...but if i run will open i window and
wait i password for the command runas -.-" while if i run this
in .vbs: wscript xxxx.vbs it work...
why?
tnx, Pietro
Comment