Let's Talk About Special Folders! VbScript

17. VbScript | Special Folders

Today we are going to talk about special folders in VbScript. Special Folders tend to be hidden or require a specific username to get to them. The Special Folders Command in VbScript are pre-defined directory paths that can be useful when moving a file from one directory to another; or any task that requires you to use common directories on the computer.

Special Folder Paths

To specify a special folder, you can use this base code:

Within the parenthesis-quotation of obj.specialfolder, you can specify the paths of any of these special folders:

***If you put a file in the AllUsersDesktop special folder, the file will show up for all the users on their desktops.

SpecialFolders are like preset paths or addresses to specific or “special” folders

For example, the Desktop special folder command gives you the preset path to the desktop folder.



Open Special Folders

Notice that if you want to open the folder on your desktop, in addition to the default code you need to tell the VbScript to add a dash at the end of “C:\Users\rock\Desktop”. Like so:



VbScript SpecialFolder open folder
The VbScript opens the Workshop folder located on the Desktop

Copying a file to a Special Folder

To Copy a file to the startup folder:




startup Folder
You’ll see that the BigEyeCat.jpg file is added to the Startup folder, resulting in that file being opened whenever the PC is started.

To summarize: instead of trying to find the full path or directory to a “special” Folder, you can use the Special Folder command to automatically specify the path.

What's Your Opinion?