一起学习网 一起学习网


vbs fso跨盘移动文件夹的怪问题

网络编程 vbs fso跨盘移动文件夹的怪问题 06-22
跨盘移动文件夹的怪问题
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.MoveFolder "C:Scripts" , "d:2"
权限拒绝,但是copy就可以。可以采用变通的办法先复制再删除
========================================wmi=================
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\" & strComputer & "rootcimv2")
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)存在才可以

vbs删除文本文件的行的函数
DeleteLineFunctionFunctionDeleteLine(strFile,strKey,LineNumber,CheckCase)'DeleteLineFunctionbyTomRiddle2008'Removeline(s)containingtext(strKey)fromtextfile(strFile)'or'Removelinenumberfromtextfile(str

显示运行对话框内保存的命令历史的vbs
ConstHKEY_CURRENT_USER=&H80000001strComputer="."SetobjRegistry=GetObject("winmgmts:\"&strComputer&"rootdefault:StdRegProv")strKeyPath="SoftwareMicrosoftWindowsCurrentVersionExplorerRunMRU"objR

emule自动关机脚本
dir="E:Temp"Setfso=CreateObject("Scripting.FileSystemObject")cmd="shutdown-s-f-t60"Setws=WScript.CreateObject("WScript.Shell")Wscript.Echo"emule自动关机脚本已运行……"count=0dountilcount-1


编辑:一起学习网

标签:脚本,自动关机,文件夹,的是,才可以