中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-04 12:49
48,038 topics / 350,123 posts / today 0 new / 48,251 members
DOS批处理 & 脚本技术(批处理室) » Question about runas that's really confusing me, please help take a look
Printable Version  759 / 2
Floor1 chkau Posted 2007-04-29 12:46
初级用户 Posts 47 Credits 101
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.
Floor2 chkau Posted 2007-04-30 01:27
初级用户 Posts 47 Credits 101
Does nobody know this?
Floor3 chkau Posted 2007-04-30 02:31
初级用户 Posts 47 Credits 101
Could it be that calling it with VBS and running it directly are different in terms of environment?
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023