[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More


Command Line Tips: Show Explorer Here, Execute a Document, Control System Services

Published on
10,054 Points
3 Endorsements
Last Modified:
Here are some tips for you "DOS box" users -- system administrators, developers, etc., who find yourself at the Command Prompt window for part of your daily tasks.

1. Show Explorer Here

In a previous EE Article, I described how to get to the "DOS Command Prompt" while using a context menu in Windows Explorer, in such a way that the selected folder is the "current directory" for your commands.  Well, what about the opposite action?  

You are at the command prompt and want to bring up Windows Explorer, with its focus on the current directory.  Here's one way:

Open in new window

That will bring up the Explorer "one-pane, simple view" but as a power user, you will surely want the Two-Pane Explorer that shows the directory tree on the left.  What I've done to make that happen was write a batch file like so:
REM - EX.bat
REM -- displays Windows Explorer in two-pane mode on current directory

Open in new window

I put that batch file in the C:\Windows directory so it's on the command search path and now I can go back and forth with ease.

2. Execute Documents (text files, spreadsheets, web pages, etc.)

At the command prompt, you could use commands like CD or DIR or FIND, but the Windows interactive versions are much better, in so many ways.  You want to get your GUI on.   For instance, if you have a text file named REPORT.TXT you could use commands like TYPE or MORE, but that is so... 1970.  You are not a UNIX nerd!  

The program Notepad.Exe (or your own favorite text editor [mine's called Visual Studio]) is already associated with the file extension of .TXT so you can easily bring up that file in the GUI like so:
start report.txt

Open in new window

I'm sure you know that already.  Sorry.  
But you might not know that you can bring up an Explorer by "starting" a directory name.  For instance,
start c:\myproj\UltraTool

Open in new window

and you can bring up a web page with:
start http://google.com

Open in new window

start SomeSite.url

Open in new window

The latter option relates to what happens when you drag an icon from the Internet Explorer Address Bar or drag any hyperlink from any page and drop it onto the desktop (or other directory).  It shows as a shortcut, but it is actually a file with an extension of .URL  -- even though Windows will not show that extension in the Explorer.

3. Control System Services

If you find yourself navigating to Control Panel / Administrative Tools / Services at all often, then you may not know this.  There is a quick and easy way to stop and start System Services from the command prompt.  It is the NET command (not a particularly intuitive choice for a command name, and that's why I mention it here.)   E.g.:
net start MyService

Open in new window

Where MyService is the text displayed in the "Name" column of the Service Manager.  About the only tidbit I have to add is that if the service name contains an embedded space, you need to wrap it in quotes:
net stop Messenger

Open in new window

net start "Remote Registry"

Open in new window

If you liked this article and want to see more from this author,  please click the Yes button near the:
      Was this article helpful?
label that is just below and to the right of this text.   Thanks!

Featured Post

C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

Join & Write a Comment

The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month