开发者

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).


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.


/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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜