This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Tomcat and the fly likes Set Environment Variable From CMD Prompt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Set Environment Variable From CMD Prompt" Watch "Set Environment Variable From CMD Prompt" New topic
Author

Set Environment Variable From CMD Prompt

James Ellis
Ranch Hand

Joined: Oct 14, 2004
Posts: 205
For various reasons I need to be able to set an environment variable from DOS and have that value still be present when the machine is rebooted. Using the "SET" command the value is only valid for the open DOS window. Anyone know how to do this?

PS - I know about Control Panel/System/Advanced Tab...I need to do it through DOS/CMD Prompt.

Thanks,
Jim
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Windows used to use a file called 'autoexec.bat' for setting environment variables. They stopped shipping it in newer versions but I think the OS still looks for it and runs it, if it's there.

I believe it looks in 'c:\'


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

I don't see why you couldn't put your own batch file in the startup folder either...


If you get it working, report back with you you did it.
James Ellis
Ranch Hand

Joined: Oct 14, 2004
Posts: 205
I believe the way I'm going to handle it is to try and set these variables through the InstallAnywhere script that will install the program. I'll let everyone know if I think of another way to do this.

Thanks,
Jim
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Set Environment Variable From CMD Prompt
 
Similar Threads
Classpath
yet again - classpath
To set CLASSPATH in Win 98
compiling a servlet
How do you Unzip a JAR file