跨盘移动文件夹的怪问题
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.MoveFolder "C:\Scripts" , "d:\2"
权限拒绝,但是copy就可以。可以采用变通的办法先复制再删除
========================================wmi=================
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colFolders = objWMIService.ExecQuery _
("Select * from Win32_Directory where name = 'c:\\Scripts'")
For Each objFolder in colFolders
errResults = objFolder.Rename("d:\\VBScript")
Wscript.Echo errResults
Next
错误码13,估计是更名的时候不允许ren c:\1 d:\2这样的格式
========================Shell.Application可以成功====================
Const FOF_CREATEPROGRESSDLG = &H0&
TargetFolder = "c:\3"
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.NameSpace(TargetFolder)
objFolder.MoveHere "d:\downloads", FOF_CREATEPROGRESSDLG
但是必须目标文件夹(像本例的是c:\3)存在才可以
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!