I mapped a shared folder from the network to local, with drive letter Z:, and under it there is a folder named 123.
If I directly execute the batch file 1.bat on drive E and enter the administrator password, it can copy normally. The contents are as follows:
runas /noprofile /savecred /user:administrator\administrator e:\1.bat
xcopy /e /z /d /y /i /k /h /r /v /c z:\123 e:\123
exit
But if I use the following VBS script to call 1.bat, 1.bat does run, yet it says it can't find the drive letter.
Dim oShell
Set oShell = WScript.CreateObject("WScript.Shell")
oshell.Run "runas /noprofile /savecred /user:administrator\administrator e:\1.bat"
wscript.sleep 100
oshell.SendKeys "123"
wscript.sleep 10
oshell.SendKeys "{ENTER}"
Question for all you experts, where exactly is the problem here? I really can't figure out what exactly went wrong.
If I directly execute the batch file 1.bat on drive E and enter the administrator password, it can copy normally. The contents are as follows:
runas /noprofile /savecred /user:administrator\administrator e:\1.bat
xcopy /e /z /d /y /i /k /h /r /v /c z:\123 e:\123
exit
But if I use the following VBS script to call 1.bat, 1.bat does run, yet it says it can't find the drive letter.
Dim oShell
Set oShell = WScript.CreateObject("WScript.Shell")
oshell.Run "runas /noprofile /savecred /user:administrator\administrator e:\1.bat"
wscript.sleep 100
oshell.SendKeys "123"
wscript.sleep 10
oshell.SendKeys "{ENTER}"
Question for all you experts, where exactly is the problem here? I really can't figure out what exactly went wrong.
