Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: What is the correct way to add directory to path from command line?

1 Week Ago   #1
peter7277

Windows 7 Ultimate x64
 
 
What is the correct way to add directory to path from command line?

I found different examples searching google and i am not sure which is the right one. I used this:
Code:
setx  my_path "%PATH%"
Is this the correct way? Also, how to add the directory to system variables, because this command adds the directory to user variables?


My System SpecsSystem Spec
.
1 Week Ago   #2
SIW2

Microsoft Community Contributor Award Recipient

Vista x64 / 7 X64
 
 

SETX ... /M

Safest to backup first.


User Variables: HKCU\Environment

System Variables: HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment

SetX - Set environment variables - Windows CMD - SS64.com
My System SpecsSystem Spec
1 Week Ago   #3
Paul Black

Win 7 HP SP1 64-bit Vista HB SP2 32-bit Linux Mint 18.3
 
 

Quote   Quote: Originally Posted by SIW2 View Post
SETX ... /M

Safest to backup first.

User Variables: HKCU\Environment
System Variables: HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
SetX - Set environment variables - Windows CMD - SS64.com
My System SpecsSystem Spec
.

1 Week Ago   #4
peter7277

Windows 7 Ultimate x64
 
 

I added the directory with this command:
Code:
setx  e:\scripts "%PATH%" /M
and it showed:
Code:
SUCCESS: Specified value was saved
but it doesn't seem to work. I have some .cmd scripts in this directory and if i try to type the name of any of the script in the command prompt, it doesn't find them.
My System SpecsSystem Spec
1 Week Ago   #5
samuria

win 8 32 bit
 
 

At a cmd prompt type



set


is it there
My System SpecsSystem Spec
1 Week Ago   #6
peter7277

Windows 7 Ultimate x64
 
 

What i am trying to do is to add youtube-dl command line tool to system path, so when i type 'youtube-dl' in the command prompt to be able to execute the command, no matter the location i am currently. But for some reason it doesn't work no matter if i add the directory manually or through the command line. And, yes, if i type 'set' the directory is listed.
My System SpecsSystem Spec
Reply

 What is the correct way to add directory to path from command line?




Thread Tools




Similar help and support threads
Thread Forum
Windows Command-Line: The Evolution of the Windows Command-Line
Read more: Windows Command-Line: The Evolution of the Windows Command-Line Windows Command Line Tools For Developers
News
Microsoft windows opening folder directory without going to the path
I was attaching something to an email and I had not gone to the directory of the file since logging in. Clicking the attach item button brought me straight to the directory of the attachment I was going to send. Windows 7 has never done this before. Why would it do this? The only reason as to why...
Software
Directory path inquiry
Hi :) I have an app - Cubase - which requires the user to browse to a specific dir. when creating a new project. Unlike Windows' copy/move to folder: http://www.jeffreyhayat.com/mtf.jpg - there is no 'folder path' field which enables you to paste or type a dir:
General Discussion
Executing command line command anywhere ?
I want to create a setup whereas a command line command can be run from any directory/folder, without having to be in the directory/folder whereas the command line command resides ?
General Discussion
Want to edit Bootmgr's directory path.
Ok I use a program called Hirens to do all kinds of stuff at work, and we know we can put 1 OS into the root directory and it will start a install of that OS. What I want to do is have it set up so I can install any OS I have on my portable hard drive. I have the file system set up like this.....
Installation & Setup


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 08:23.
Twitter Facebook