Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: DirMove Folder Directory Move
Method 1: Windows Shell COM Object
FOF_CREATEPROGRESSDLG = 0 ;Create Progress dialog sourcedir = 'C:\Scripts' targetdir = 'D:\Archive' oShell = ObjectCreate("Shell.Application") oFolder = oShell.NameSpace(targetdir) oFolder.MoveHere( sourcedir, FOF_CREATEPROGRESSDLG ) oShell = 0Method 2: WMI
strComputer = '.' sourcedir = 'C:\Scripts' targetdir = 'D:\Archive' objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" : strComputer : "\root\cimv2") colFolders = objWMIService.ExecQuery ("Select * from Win32_Directory where name = '" : sourcedir : "'") ForEach objFolder In colFolders errResults = objFolder.Rename( targetdir ) Next colFolders = 0 objWMIService = 0Method 3: FileSystem Object
sourcedir = 'C:\Scripts' targetdir = 'D:\Archive' objFSO = CreateObject("Scripting.FileSystemObject") objFSO.MoveFolder( sourcedir , targetdir ) objFSO = 0
Article ID: W17464
File Created: 2008:04:10:15:10:56
Last Updated: 2008:04:10:15:10:56