Rename Folder via FileSystemObject (FSO)

VBScript using WMI to rename a folder
Language:
WMI
Keywords:
VBScript; WMI; FSO
Code Snippet

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colFolders = objWMIService.ExecQuery _
    ("Select * from Win32_Directory where name = 'd:\\web\\Downloa\ '")
For Each objFolder in colFolders
    errResults = objFolder.Rename("d:\\web\downloa\1")
    Wscript.Echo errResults
Next


Created 2012-02-01
comments powered by Disqus
Login