Change Windows Explorer’s (in taskbar) Starting Location (VBScript)
Introduction
The script shows how to change Windows Explorer’s (in taskbar) Starting Location in Windows 8.
Scenarios
When you start 'Windows Explorer (in taskbar)', it will navigate to 'Library' by default. However, sometimes people want it to navigate to a folder or 'Computer’. This script can achieve that. And i think it will be more convenient if we set 'Windows Explorer' to start with folder that we access most frequently.
Script
You can use this script in the following ways:
Method 1: Drag a folder to the script.
Method 2: Use the script in command line. And the exact commands are shown below.
Here are some code snippets for your reference.
VB ScriptEdit|RemovevbsFunction ChangeLocation(Path,Arguments) 'This function is to change the starting location On Error Resume Next Dim objshell,Appdata,LinkPath ,FSO,ShortCut Set objshell = CreateObject("wscript.shell") 'Get the appdata path Appdata = objshell.ExpandEnvironmentStrings("%APPDATA%") 'Get the file explore path LinkPath = Appdata & "\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\File Explorer.lnk" Set FSO = CreateObject("scripting.filesystemobject") If FSO.FileExists(LinkPath) Then Set ShortCut = objshell.CreateShortcut(LinkPath) Shortcut.Targetpath = Path Shortcut.Arguments = Arguments Shortcut.save WScript.Echo "Set 'File Explore' starting location successfully." Else WScript.Echo "Not find 'File Explore' in taskbar,please pin it manully." End If If Err.Number <> 0 Then WScript.Echo "Failed to set the starting location." End If End FunctionFunction ChangeLocation(Path,Arguments) 'This function is to change the starting location On Error Resume Next Dim objshell,Appdata,LinkPath ,FSO,ShortCut Set objshell = CreateObject("wscript.shell") 'Get the appdata path Appdata = objshell.ExpandEnvironmentStrings("%APPDATA%") 'Get the file explore path LinkPath = Appdata & "\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\File Explorer.lnk" Set FSO = CreateObject("scripting.filesystemobject") If FSO.FileExists(LinkPath) Then Set ShortCut = objshell.CreateShortcut(LinkPath) Shortcut.Targetpath = Path Shortcut.Arguments = Arguments Shortcut.save WScript.Echo "Set 'File Explore' starting location successfully." Else WScript.Echo "Not find 'File Explore' in taskbar,please pin it manully." End If If Err.Number <> 0 Then WScript.Echo "Failed to set the starting location." End If End Function
Examples
Example 1: Set an any folder as File Explorer’s (Taskbar) starting location.
Command: Drag a folder to the script.
Screenshot:

Example 2: Set 'My Computer' as File Explorer’s (Taskbar) starting location.
Command: C:\script\FileExploreStartingLocation.vbs /tar:Mycomputer
Screenshot:

Example 3: Set "My document" as File Explorer’s (Taskbar) starting location by using CLSID.
Command: C:\script\FileExploreStartingLocation.vbs /tar:"%SystemRoot%\explorer.exe" /arg:"/n,::{450D8FBA-AD25-11D0-98A8-0800361B1103}"
Screenshot:

Note You can set "library" as starting location by using similar command in Example 2.
Prerequisite
Windows 8