开发者

Pass arguments with white spaces to batch file

开发者 https://www.devze.com 2023-01-27 21:38 出处:网络
I am so sure answer is as simple as passing \"\" to the arguments in batch file. But this fails. Here is what I am trying to do.

I am so sure answer is as simple as passing "" to the arguments in batch file. But this fails. Here is what I am trying to do.

Test.bat env "Some cmd"

This "Some cmd" is ano开发者_Python百科ther command that needs to run in environment set by env.

Test.bat:

Something like  set Env with %1%

set cmd=%2%

%cmd%

The above fails with '"Some cmd"' is not recognized as a cmd.

Only way I can get this to work is if I use "%cmd%" in batch file. Is this right?


I think you need to specify path where "Some cmd" is present.

0

精彩评论

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