Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Machine Learning with R: Expert techniques for predictive modeling this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Is there an easy way to update DOS shell after Environment Variables changes?

 
Ranch Hand
Posts: 1855
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I was sure that I could once easily update my DOS shell when I changed my system environment variables.

But I've forgotten how .

Regards,
Darya
[ March 17, 2007: Message edited by: Darya Akbari ]
 
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Parse Exception on my end...

What do you mean "update the DOS shell" ?

Are you asking how to alter DOS env vars prior to executing something in system process?
 
Sheriff
Posts: 24654
58
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You mean you changed the environment variables via the Control Panel? Then opening a new DOS shell would be the easiest way to do that.
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe that he is referring to the fact that if you open a dos shell, it takes a snap shot of the environment variables, and changing any of these variables elsewhere (like the control panel) doesn't get reflected in your current shell, only in new shells. I have had the same problems when forking new applications where they see the old values and not updates.

From memory there is supposed to be a flag ( maybe /I ?) that can be specified in the command shell telling it to update itself, but I never managed to this working.

check 'start /?' from the command line
 
Darya Akbari
Ranch Hand
Posts: 1855
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry when I was not very clear with my question. Dave gives a better description of what my problem is.

Originally posted by David O'Meara:
check 'start /?' from the command line



start starts a new DOS shell, however I want to remain in my current one .
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're right about the new shell, my problem was actually needing to fork a new shell with an updated environment.
 
Darya Akbari
Ranch Hand
Posts: 1855
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any more hints ?
 
Bartender
Posts: 2653
18
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Darya Akbari:
Any more hints?


I'm afraid there is no such functionality available.
The environment gets set when you start the shell session, and the only way to change it is by making the changes in the session itself.

reference: Command shell overview.

Regards, Jan
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use this setting in XP pro to change the windows shell, then you can use something else, but the only free, better one I found was Windows PowerShell, but no idea if it has the feature you/we want.

You may be able to find another shell with the desired features, I couldn't.
 
Darya Akbari
Ranch Hand
Posts: 1855
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your answers and sharing that tedious pain with me. I'm sure that it was not a dream of mine . There was a trick .

Whatsoever, when I find an answer to it I'll let you know

Regards,
Darya
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One thing the PowerShell has that is normally available is the ability to browse the registry like a file system from the command line. Environment settings are kept in the registry, so it may be possible to poll for environment variable changes this way. Not clean, but a possibility. Unless of course each shell gets its own registry copy (possible) in which case you're still in trouble.
 
It's just like a fortune cookie, but instead of a cookie, it's pie. And we'll call it ... tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!