Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Batスクリプトファイルの別のコマンド内でコマンドを実行するためのWindowsの同等の構文はありますか?
Linux では、単純に$(...)または ``を使用できます。
はい、少なくとも簡単なことについては:
@setlocal enableextensions enabledelayedexpansion @echo off for /f %%w in ('echo xyzzy') do set var=%%w echo Output is %var% endlocal
そのスクリプトの出力は次のとおりです。
Output is xyzzy
コマンドxyzzyから来ると。echo
xyzzy
echo
コマンド ウィンドウから実行for /?すると、より包括的なオプションのリストが表示されます。
for /?