How can I add a program path to the Windows environment variables for easy command line access?

33,682

Solution 1

This should be able to be done by setting the "Path" when your computer starts up. So you're using Win 7... Just wondering why you're using the command line to launch these?? There are much easier and quicker ways....

The path is now managed by Windows 7 and not the autoexec.bat or autoexec.nt files. To change the system environment variables, follow the below steps.

1.From the desktop, right-click My Computer and click Properties.

2.In the System Properties window, click on the Advanced tab.

3.In the Advanced section, click the Environment Variables button.

4.Finally, in the Environment Variables window, highlight the Path variable in the Systems Variable section and click the Edit button. Add or modify the path lines with the paths you wish the computer to access. Each different directory is separated with a semicolon.

Hope this helps

Solution 2

  1. Run Regedit
  2. Go to "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths"
  3. Create "VLC" subsection
  4. Add "Path" field of type REG_SZ with "C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" value.

Here is an iteresting historical explanation of AppPaths from Raymond Chen: http://blogs.msdn.com/b/oldnewthing/archive/2011/07/25/10189298.aspx

Share:
33,682

Related videos on Youtube

Doug
Author by

Doug

Updated on September 18, 2022

Comments

  • Doug
    Doug over 1 year

    Let's say I want to add the following path to the Windows environment variables: C:\Program Files (x86)\VideoLAN\VLC\vlc.exe Such that I can simply type the following from a command line without using the entire path: vlc.exe filename.avi

    What is the easiest way to do this?

  • Doug
    Doug about 10 years
    Why? I want to be able to run programs with command line parameters. Example: vlc.exe --video-splitter=wall --wall-cols=2 --wall-rows=1 --wall-element-aspect=16:10 --wall-active=1 --monitor-par=1:2 videofilename.mkv
  • Harshil Sharma
    Harshil Sharma about 10 years
    That's because some programs automatically add their path into the PATH variable. You can check your system's PATH variable to confirm that.
  • DrColossos
    DrColossos about 10 years
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes.
  • Doug
    Doug about 10 years
    Do you have suggestions on how to do that?
  • Protector one
    Protector one over 6 years
    I can't get this to work in Windows 10. Also, "running Wordpad by typing its name", like that article states, also doesn't work.