开发者

windows batch / multiple commands per line

I use Windows and I have a C program which calls popen to execute a command dynamically.

But if i try to execute something like this:

set a=10
echo %a%

it doesnt work.

I tried (manually) to save the command as the following C strings:

  • set a=10&echo %a% => Output: %a%
  • set a=10\necho %a% => Output: "" (empty)
  • set a=10\r\necho %a%\r\n => Ou开发者_JS百科tput: "" (empty)

It should output "10". How can I do this?


you mean execute a DOS command dynamically? you could try something like

%systemRoot%\system32\cmd.exe \c set a=10&echo%a%
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜