Windows XP Hacks Free Open Book

Windows XP Hacks

Previous Section Next Section

Hack 22 Control Windows Explorer with Command-Line Shortcuts

figs/expert.giffigs/hack22.gif

Create customized Explorer views from the command line, and save your favorite views in desktop shortcuts.

I rarely open Windows Explorer in its default view. Instead, I generally want to open it at a specific location, with a specific set of viewing features—for example, with the Folders bar in the left side on or off.

I launch Windows Explorer from the command line, along with a set of switches for controlling how it opens. I also create desktop shortcuts out of these command-line launches, so that my favorite views are always only a couple of clicks away.

For example, when I want to open Windows Explorer to the C:\Power Tools Book\Hacks subfolder only, with no folders above it, and using the Folders bar, I open the command prompt and issue this command:

explorer /e,/root,c:\Power Tools Book\Hacks

When I do that, the view pictured in Figure 3-7 appears.

Figure 3-7. Opening Windows Explorer to a specific folder with a specific view
figs/xph_0307.gif

Compare that view with my default view that I get when I launch Windows Explorer the normal way (shown in Figure 3-8). Not only does the Explorer view in Figure 3-7 open to a specific subfolder, but it also shows no folders above it. In contrast, Figure 3-8 shows the entire structure of my hard disk and opens to C:\. I use the view in Figure 3-7 when I want to work exclusively on a specific subfolder and want to get to it quickly.

Figure 3-8. My default for launching Windows Explorer
figs/xph_0308.gif

This is just one of the many uses for launching Windows Explorer from the command line with switches; no doubt you'll be able to find other uses for it. You'll be able to use it not only on the command line and with desktop shortcuts, but also if you run scripts and batch programs.

The syntax for running Explorer from the command line with switches is:

explorer  [/n]  [/e] [,root,object] [[,/select],subobject]

You don't have to use switches; you can type explorer by itself, though doing that launches your default Explorer view.

Here is an explanation of how to use the switches and syntax:

/n

Opens Windows Explorer without displaying the Folders bar, the tree structure of the hard drive. Instead, it launches the view shown in Figure 3-9.

Figure 3-9. The view of Explorer using the /n switch
figs/xph_0309.gif
/e

Opens Windows Explorer displaying the Folders bar.

/root ,object

Opens Windows Explorer to a specific object, such as a folder, without displaying the folders above it, as shown in Figure 3-7. You can also use Global Unique Identifiers with this switch, as explained later in this hack.

[[/select] ,subobject]

Opens Windows Explorer to a specific file or folder that is then highlighted or expanded. You can use the subobject switch only without the /select parameter. When you include the /select parameter, the branches are not expanded, the folder is highlighted, and the subobject is highlighted in the right pane.

3.3.1 Create Desktop Shortcuts for Explorer

Typing command-line shortcuts can quickly give you a case of carpal tunnel syndrome, so a better idea is to run them as desktop shortcuts. Right-click on the desktop, choose New Shortcut, and in the location box type the Explorer command-line syntax you want to use. Click Next and give the shortcut a descriptive name—for example, "Hacks folder"—and click OK.

3.3.2 Using Global Unique Identifiers (GUIDs) with Command-Line Switches

You might want to open Explorer to certain system folders—for example, to My Network Places. To do so, run explorer from the command line and follow it by a space, two colons, and the Global Unique Identifiers (GUIDs) that identify specific system folders, like this:

explorer  ::{208D2C60-3AEA-1069-A2D7-08002B30309D}

That command opens Windows Explorer to My Network Places.

If you're using switches, similarly put a space and two colons in front of the GUID, like this:

explorer /e, ::{208D2C60-3AEA-1069-A2D7-08002B30309D}

You can use GUIDs in desktop shortcuts, batch files, and scripts, as well as at the command line. Table 3-1 lists the GUIDs for various system folders.

Table 3-1. GUIDs for system folders

Folder name

GUID

My Computer

{20D04FE0-3AEA-1069-A2D8-08002B30309D}

My Network Places

{208D2C60-3AEA-1069-A2D7-08002B30309D}

Network Connections

{7007ACC7-3202-11D1-AAD2-00805FC1270E}

Printers and Faxes

{2227A280-3AEA-1069-A2DE-08002B30309D}

Recycle Bin

{645FF040-5081-101B-9F08-00AA002F954E}

Scheduled Tasks

{D6277990-4C6A-11CF-8D87-00AA0060F5BF}

    Previous Section Next Section
    Index: [SYMBOL][A][B][C][D][E][F][G][H][I][J][L][M][N][O][P][Q][R][S][T][U][V][W][X][Z]


         Main Menu
    Main Page
    Table of content
    Copyright
    Credits
    Preface
    Chapter 1. Startup and Shutdown
    Chapter 2. The User Interface
    Chapter 3. Windows Explorer
    3.1 Hacks #21-32
    Hack 21 Generating Folder and File Listingsfor Printing or Editing
    Hack 22 Control Windows Explorer with Command-Line Shortcuts
    Hack 23 Empower Windows Explorer with PowerDesk
    Hack 24 Better File Rename
    Hack 25 Find Files Faster by Mastering the Indexing Service's Query Language
    Hack 26 Hiding Folders and Files with the Encrypting File System
    Hack 27 Forcing Windows Explorer Into True Usefulness
    Hack 28 Customize Folder Icons and Balloon Text
    Hack 29 A Power User's Hidden Weapon: Improve the Context Menu
    Hack 30 Take Your Work on the Go with Offline Files and the Briefcase
    Hack 31 Get More Hard Disk Space by Using NTFS Compression
    Hack 32 Put a Command-Line Prompt on Your Desktop
    Chapter 4. The Web
    Chapter 5. Networking
    Chapter 6. Email
    Chapter 7. The Registry
    Chapter 8. Basic Utilities
    Chapter 9. Applications
    Chapter 10. Graphics and Multimedia
    Chapter 11. System Performance
    Chapter 12. Hardware
    Colophon
    Index


    More Books
    PHP Hacks
    Processing Xml With Java - A Guide To Sax, Dom, Jdom, Jaxp, And Trax
    The Koran (Holy Qur'an)
    Macromedia Flash 8 Bible
    Search Engine Optimization for Dummies
    YouTube Traffic
    PHP 5 for Dummies
    Harry Potter and The Chamber of Secrets
    Harry Potter and the Sorcerer's Stone
    The Pilgrim's Progress
    Wireless Hacks
    Flash Hacks. 100 Industrial-Strength Tips & Tools
    PayPal Hacks. 100 Industrial-Strength Tips and Tools
    Amazon Hacks
    Pdf Hacks
    The Da Vinci Code
    Google Hacks
    The Holy Bible
    Windows XP For Dummies
    Harry Potter and the Half-Blood Prince
    Seo Book
    Upgrading and Repairing Networks
    Macromedia Dreamweaver 8 UNLEASHED
    Windows XP Annoyances
    Windows XP Hacks
    Microsoft Windows XP Power Toolkit
    Teach Yourself MS Office In 24Hours
    iPod & iTunes Missing Manual
    PC Hacks 100 Industrial-Strength Tips and Tools
    PC Overclocking, Optimization, and Tuning - 2th Edition
    PC Hardware In A Nutshell 3rd Edition
    PC Hardware in a Nutshell, 2nd Edition
    Upgrading and Repairing PCs
    Google for Dummies
    MySQL Cookbook
    Teach Yourself Macromedia Flash 8 In 24 Hours
    PHP CookBook
    Sams Teach Yourself JavaScript in 24 Hours
    PHP5 Manual
    Free Games Paper Airplanes
    500 Juegos Gratis 500 Giochi Gratis 500 Jeux Gratuits 500 Jogos Gratis 500 Kostenlose Spiele