Jump to content

change environment variables + opening cmd shell in a folder


Recommended Posts

Posted

Hi,

I am trying to come up with a simple way that i can change environment variables and then open a cmd shell in an folder

and see the changed variables without re-booting the machine.

I run Cmd shell in 2 different ways

1. START-Run-cmd

This always opens in some Windows directory.

2. In explorer, i can right click on a folder and open a Cmd shell in that directory. Microsoft have a support tool to

do this, but you can do the same with the following registry entries.

[HKEY_LOCAL_MACHINE\Software\Classes\Folder\Shell]

[HKEY_LOCAL_MACHINE\Software\Classes\Folder\Shell\AcraFlow: Open Cmd Shell]

[HKEY_LOCAL_MACHINE\Software\Classes\Folder\Shell\AcraFlow: Open Cmd Shell\command]

@="cmd.exe /k pushd %L"

I have found 2 useful utilites for setting environment variables, setx.exe and setenv.exe.

What i have done so far is

1. created a .bat file to set the environment variable to what i want. I double click on the file to set the variable.

setenv -u MYVARIABLE myvalue

2. If i open a command shell as follows, and run the set command, i see the variable MYVARIABLE

START-Run-cmd

3. However, if i open a command shell using a right click on a folder in Explorer, and run the set command, i dont see the variable.

Why is this? Its very frustrating.

Any help would be really appreciated.

Thanks

Delbert.


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...