/build/static/layout/Breadcrumb_cap_w.png

Moving folder in VBscript

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?

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

Shell
Const FOF_CREATEPROGRESSDLG = &H0&
TargetFolder = "D:\Archive"
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.NameSpace(TargetFolder)
objFolder.MoveHere "C:\Scripts", FOF_CREATEPROGRESSDLG

0 Comments   [ + ] Show comments

Answers (2)

Posted by: WiseUser 19 years ago
Fourth Degree Brown Belt
0
"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)?
Posted by: Naffcat 19 years ago
Senior Purple Belt
0
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
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ