Cynosure.X International LLC

:

Add Comment | Related Links | TrackBack
Related Content

Set Up Environment Variables Upon Launching Command Prompt

The Windows "Command Prompt" uses environmental variables that are set in "System Properties" -> "Environment Variables". Modifying them to your needs is easy enough if you have access. But on many computer systems, the "System Properties" are locked out of non-administrator users. One work around is to place all your environmental variable into a batch script and manually run it after starting the "Command Prompt". But in this article, I will demonstrate a quicker and more automated method.

Let's go with a made-up, but realistic example. Java is installed on your system. But it's not in your PATH variable. And CLASSPATH is also not defined. You want these two variables to be set every time you launch "Command Prmopt", but you don't have administrator rights. You also want "Command Prompt" to be in your Desktop directory when it launches. Ok. Easy enough. Here is the solution:

@echo off

set CLASSPATH=h:\classes
set PATH=C:\Program Files (x86)\Java\jre7\bin;%PATH%

cd "%UserProfile%\Desktop"
cmd

Put the above batch code into an executable batch script (say, "My Shell.cmd"). Now whenever you double-click the batch file, it sets up the environmental variables, changes to the desired directory, and starts the "Command Prompt".

Mel
Thu, 07 Nov 2013 03:11:35 +0300

Add Comment | Related Links | TrackBack
Related Content

Did your message disappear? Read the Forums FAQ.

Add Comment

Spam Control | * indicates required field
Your Name: *
E-mail:
Remember Me!
Comment: *
File attachment is optional. Please do not attach a file to your submission unless it is relevent.
Attach File:
(20 MB Max)
Spam Protection: * Answer of 6 + 0?
Click button only once, please!

TrackBack

TrackBack only accepted from WebSite-X Suite web sites. Do not submit TrackBacks from other sites.

Send Ping | TrackBack URL | Spam Control

No TrackBacks yet. TrackBack can be used to link this thread to your weblog, or link your weblog to this thread. In addition, TrackBack can be used as a form of remote commenting. Rather than posting the comment directly on this thread, you can posts it on your own weblog. Then have your weblog sends a TrackBack ping to the TrackBack URL, so that your post would show up here.

Messages, files, and images copyright by respective owners.

Products | Services
Forums | Latest | RSS
Library | Search | Wiki
Help | Licenses

Login | Register

77 Users Online

Hacking Digital Cameras
Fun for Photographers



Amazon Associate

Copyright © 1996 - 2024. All Rights Reserved.