Updated ‘This PC’ Namespace Item Creation Tool v1.5
Today, we have an update to the utility introduced in the previous article Creating ‘This PC’ Namespace Items. If you haven’t yet read it, it describes a Registry-based mechanism for adding items pointing to arbitrary network or local folders in Windows Explorer’s “This PC” (aka “My Computer”) without employing drive letters. The version of the utility presented in that post to implement this capability allowed specifying the desired item’s display name, target location, and “info tip” (hover text). It also allowed clearing (removing) all “This PC” items created within the current logon session without having to log off. (As explained in the above article, logoff also clears all items created by the utility since the mechanism behind it is inherently non-persistent). Based on feedback from colleagues and my own usage, the updated utility presented here compatibly expands the syntax to also allow
- optionally specifying the created item’s display icon
- clearing a specified item (rather than all of them)
- bulk-creating multiple items in a single launch via a provided list of item specifications (a text file).
A skeleton version of the expanded syntax is shown in the following screenshot (run the utility without arguments or with /? to display it).
What follows are the detailed syntax and usage notes (as always, arguments containing spaces must be enclosed in double-quotes):
To create a single “This PC” item, use
ThisPC_Item display_name target_path [info_tip [iconspec]]
- If an info tip is not specified, the item’s target path will be used as its hover text.
- To use this default info tip when specifying a display icon (optional 4th argument), use a blank string (“”) as the 3rd argument.
- The optional icon specification can be the full path to a .ico icon file, or to an executable (.exe/.dll/etc.) optionally followed immediately by an icon index (,#), for example %SystemRoot%\System32\imageres.dll,220 for a nice “cloud” icon. An invalid icon specification (a missing file, for example) will result in a generic folder icon being used by Windows Explorer.
- If no icon is specified, a local or network folder icon will automatically be used, depending on the item’s location.
- The return code (%ErrorLevel%) will be 0 for success, 99 for a syntax error, and 1 for any other error (the system will remain unchanged).
To remove a specific previously created item from “This PC” within the current logon session, use
ThisPC_Item /Clear display_name
To remove all previously created item from “This PC” within the current logon session, use
To bulk-create (and/or clear) multiple items via a single launch of the utility, use
ThisPC_Item /From filespec
- Here filespec must be the path to a text file containing, on separate lines, item specifications (display_name target_path [info_tip [iconspec]]), or /Clear display_name, or /ClearAll.
- Blank lines and comments (lines starting with a semicolon) in the specification file are ignored.
- Lines are processed in order top to bottom, and processing will stop at any line that results in an error (syntax or other). In such cases, the return code will be 99##, where ## is the line number at which the error was encountered. Lines following that line will not have been processed.
- A typical specification file would look something like this, with a resulting “This PC” shown in the subsequent screenshot:
; Clear existing items /ClearAll ; Create new items "Cloud Folders" %UserProfile%\CloudSync "OneDrive, Sharefile, Box, etc." %SystemRoot%\System32\imageres.dll,220 "My Utilities" C:\Utility "" C:\Utility\Icons\JB.ico "Network Utilities" \\ServerX\Shared\Utilities "Media Files" E:\Data\Media "" C:\Utility\Icons\Zune.ico
Again, for an explanation of the utility’s underlying mechanism (especially its non-persistent nature) and for some possible use cases, please read the parent article.
Follow Jacques Bensimon on Twitter @JacqBens for more great Windows insights and Tricks.