蝙蝠的Windows的替代内嵌的Bash命令 [英] Windows bat alternative for Bash inline command

查看:153
本文介绍了蝙蝠的Windows的替代内嵌的Bash命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何Windows平台上类似的语法在蝙蝠的脚本文件运行另一命令中的命令?

Is there any Windows equivalent syntax to run a command within another command in a bat script file?

在Linux中,你可以简单地使用 $(...)或``。

In Linux, you can simply use $(...) or ``.

推荐答案

是的,至少对于简单的事情:

Yes, at least for simple things:

@setlocal enableextensions enabledelayedexpansion
@echo off
for /f %%w in ('echo xyzzy') do set var=%%w
echo Output is %var%
endlocal

该脚本的输出是:

The output of that script is:

Output is xyzzy

XYZZY 从哪里来的回声命令。

运行为/?从命令窗口应该给你一个选项多个COM prehensive列表。

Running for /? from a command window should give you a more comprehensive list of options.

这篇关于蝙蝠的Windows的替代内嵌的Bash命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆