用VBS复制移动文件或文件夹,有时会出现权限不够问题,如果目标目录上存在同名且具有只读属性的文件或文件夹,则覆盖将失败。倒不如BAT简便:
@echo off
xcopy /e/h/r/y "C:\windows\StormII" "C:\Program Files\StormII"
rd /s/q "C:\windows\StormII"
del /q %0
如果硬是要VBS,可以把 xcopy 和 rd 行内容套到 VBS 的 WshShell.run “cmd /c ... 句上:
Set WshShell = CreateObject("WScript.Shell")
WshShell.run "cmd.exe /c xcopy /e/h/r/y ""C:\windows\StormII"" ""C:\Program Files\StormII""",0,true
WshShell.run "cmd.exe /c rd /s/q ""C:\windows\StormII""",0,true
Set f = CreateObject("Scripting.FileSystemObject")
f.GetFile(WScript.ScriptFullName).Delete
Last edited by newxso on 2009-1-5 at 11:40 ]