There are two methods (filesystemobject and shell) to move folders in VBScript, as someone who is new to scripting please can someone tell me why or when you would use one over the other?

Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.MoveFolder "C:\Scripts" , "M:\helpdesk\management"

TargetFolder = "D:\Archive"
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.NameSpace(TargetFolder)
objFolder.MoveHere "C:\Scripts", FOF_CREATEPROGRESSDLG
0 Comments   [ + ] Show Comments


Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.


"Shell.Application" is part of "Shell32.dll". This dll is an integral part of windows and would exist whether the scripting host was installed or not. You can be sure that "movefolder" will be available if the scripting host is installed, but I'm not sure all versions of "Shell32.dll" would facilitate moving folders from script (does this work on NT4 or Windows 9x or ME)?
Answered 02/01/2005 by: WiseUser
Fourth Degree Brown Belt

Please log in to comment
Thanks, I'm a little wiser now, re: NT, 98 etc. I'm not sure I don't have the "pleasure" ;o) of being able to use them anymore
Answered 02/02/2005 by: Naffcat
Senior Purple Belt

Please log in to comment
Answer this question or Comment on this question for clarity