简体   繁体   中英

Windows Command Line : START Command Switch /I meaning?

From ss64.com: /I: Ignore any changes to the current environment.

What does that mean? If you could give examples of usage and what it effects or doesn't effect, that would be great (none provided on website and have google searched with no luck).

/I means that The new environment will be the original environment passed to the cmd.exe and not the current environment. Any changes made to the environment variables, paths, will not reflect in the current START instance.

It Passes the Cmd.exe startup environment to the new Command Prompt window, and nothing else.

See this

If you modified the current environment by defining a variable;

set foo=bar
start app.exe

App.exe would see %foo% as being "bar"

set foo=bar
start /i app.exe

App.exe would see %foo% as being undefined.

From running start /? on my W7 box:

The new environment will be the original environment passed to the cmd.exe and not the current environment.

So the environment variables given are the ones given to the instances of cmd that start is invoked from, rather than the current environment stored on the system.

Example:

> set lol=1
> echo %lol%
1
> cmd
> echo %lol%
1

Now if I were to invoke a batch file which ran echo %lol% , but using the /I switch for start - %lol would not be defined, because I have changed the original environment settings passed to my original cmd.exe .

Why would you use it? Well say you needed to change %PATH% temporarily but then invoke a script that perhaps relied on the original version. start /I would be ideal here because no matter what you set it to, the environment passed to the cmd started by start will be whatever it was before you started your first instance of cmd .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM