%TEMP%\\test.bat" />
开发者

Why doesn't this batch file work for me?

The following batch file is not woking.

@echo off
python -c "print('echo text')" > %TEMP%\test.bat
call %TEMP%\test.bat
Can anyone help me with this?.

edit:

I needed unix e开发者_高级运维val functionality in windows. I could not find a direct way though. So I redirected the eval string to a temporary batch file and executed it. The temporary batch file was successfully created but calling it did not work in the above case. I noticed that any command after the test.bat creation did not work.


If the "python" you are calling is a batch file (python.bat in the path perhaps?) then the launching batch file will abort after calling it, unless you use the Call command like you are doing for temp.bat.

So perhaps

@echo off
call python -c "print('echo text')" > %TEMP%\test.bat
call %TEMP%\test.bat
will give you better mileage?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜