Author Topic: How do i set set path only using command prompt?  (Read 58 times)

0 Members and 1 Guest are viewing this topic.

Offline Berto

  • Full Member
  • *
  • Posts: 138
  • Karma: +0/-0
    • View Profile
How do i set set path only using command prompt?
« on: September 15, 2014, 03:09:06 AM »
How do i set set path only using command prompt? Basically, I know I can go through my control panel and modify the path variable. But, I'm wondering if there is a way to go just by using command prompt... anyone?

Techronnati | where technology never sleeps

How do i set set path only using command prompt?
« on: September 15, 2014, 03:09:06 AM »

Mountain View

Offline LadyProgrammer

  • Full Member
  • *
  • Posts: 118
  • Karma: +0/-0
    • View Profile
Re: How do i set set path only using command prompt?
« Reply #1 on: September 15, 2014, 03:12:56 AM »
Hi berto, you can try one of these:

In Vista, Windows 7 and Windows 8 we can set path from command line  using ‘setx’ command.

Code: [Select]
setx path "%path%;c:\directoryPath"
For example, to add c:\dir1\dir2 to the path variable, we can run the below command.

Code: [Select]
setx path "%path%;c:\dir1\dir2"
Alternative way is to use Windows resource kit tools ‘pathman.exe‘. Using this command we can even remove a directory from path variable.  This works for Windows 7 also.

To Add directory to system path environment variable:

Open administrator command prompt

Run  the below command

Code: [Select]
pathman /as directoryPath
Remove path from system path environment variable:
Run the below command from elevated command prompt

Code: [Select]
pathman /rs directoryPath
Setting user path environment variable:

For user environment varlables, admin privileges are not required. We can run the below command to add a directory to user path environment variable.

Code: [Select]
pathman /au directoryPath
To remove a directory from user path, you can run the below command.

Code: [Select]
pathman /ru directoryPath

Offline nomadic

  • Full Member
  • *
  • Posts: 105
  • Karma: +0/-0
    • View Profile
Re: How do i set path only using command prompt?
« Reply #2 on: September 16, 2014, 01:04:20 AM »
If you are working on some old windows machines and want to set JAVA_HOME and PATH environment variables follow the steps.

Start --> Run-->CMD .. In the command prompt first type


Code: [Select]
echo %JAVA_HOME%
 if the JAVA_HOME variable is already set the path will be printed.
eg: c:/Program Files/java1.6

else %JAVA_HOME% will be printed.

You can set JAVA_HOME by typing

Code: [Select]
SET JAVA_HOME = c:/Program Files/Java
(The path where your JRE or JDK is installed)

Then you can set the bin path by typing

Code: [Select]
SET PATH = %PATH%;%JAVA_HOME%\bin
what you are doing here is appending the existing set PATH's with JAVA_HOME/bin.

You can also directly set the path to the JAVA Bin directory instead of the above steps like

Code: [Select]
SET PATH = %PATH%;c:/Program Files/JAVA/bin
Then if you want to view the set path you can type echo %PATH%

 

Related Topics

  Subject / Started by Replies Last post
0 Replies
154 Views
Last post October 11, 2008, 06:29:20 AM
by MrSpecialist
0 Replies
1116 Views
Last post November 27, 2008, 01:45:11 AM
by MrSpecialist
0 Replies
1002 Views
Last post November 27, 2008, 02:22:04 AM
by CyborgRepublic
5 Replies
3037 Views
Last post July 24, 2010, 01:20:03 AM
by JusticeLeague
0 Replies
51 Views
Last post August 08, 2014, 03:17:18 AM
by rpmolecule

Posting Disclaimer: Any individual may post a message in this forum and may do so anonymously. Therefore, the sole author is exclusively and entirely responsible for all opinions in that message. They do not represent the official opinions of Techronnati, its administrators or moderators or the Techronnati Management. Techronnati is merely acting as an impartial conduit for constitutionally protected free speech and is not responsible and will not be held liable for the content of such messages. All images and service logos are trademarks of their respective owners.