Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

The Voice of the DBA

Steve Jones is the editor of SQLServerCentral.com and visits a wide variety of data related topics in his daily editorial. Steve has spent years working as a DBA and general purpose Windows administrator, primarily working with SQL Server since it was ported from Sybase in 1990. You can follow Steve on Twitter at twitter.com/way0utwest

Change your Windows path

When you run something from the start menu or in a Windows command prompt, you type the program name to run the executable file. There are three ways in which you can execute something:

  1. the executable is in your current directory/folder
  2. you type the entire path to the executable.
  3. the PATH environment variable contains a value that points to the folder containing the executable.

The first and second items are fairly self explanatory. In a command prompt, if I change to the \Windows folder in Windows 7, I see these executables:

path1

If I type notepad (the .exe isn’t required), Windows searches the folder, finds notepad.exe, and runs it.

If I am in c:\Users\Steve, however, I can run notepad in one of two ways. I can do this:

path2

The other way is that I just type notepad, and it runs. How does this happen? It’s a holdover from DOS (and Unix) for an environment variable called PATH. My current path is returned by typing PATH in a command prompt.

path3

 

There are a lot of folders listed here, all separated by a semi colon.  Most of these are for various programs, and lots of installers alter the path to add their own folder. For example, the Live suite of products added this path

C:\Program Files (x86)\Windows Live\Shared

I would have thought most technical people knew how to change the path, but I found a developer recently that did not. I suspect most people don’t need to deal with this in most cases, so they aren’t aware.

The way you should change this manually in Windows is this. Go to the properties of your system by right clicking the “Computer” item in the Start Menu and select Properties. You’ll get this screen (in Windows 7)

path4 

Select the “Advanced System Settings” in the left side. This is an admin function, so you need the UAC permission. This will open a new dialog

path5

The Environment variables are accessed through a button on the Advanced tab. Once you press that, it will give you the variables dialog.

path6

If you scroll down in the System Variables, you’ll see PATH as an item. Select “Edit” and you can change the path.

path7

The path is selected when this opens.

DO NOT START TYPING.

Instead hit the right arrow to de-select all the txt and move to the end (as shown in the image above). Add a semi-colon and your path, and OK back out of all dialogs. You’ll have a new path that you can use in your system.


Filed under: Blog Tagged: syndicated, windows

Comments

Leave a comment on the original post [voiceofthedba.wordpress.com, opens in a new window]

Loading comments...