0

Windows 7 DOS シェル内からその場で bash コマンド ファイルを作成しようとしています。

:: inside the .BAT file ..
:: check we are in the right directory
echo pwd > command.txt
:: get the shell to echo its environment variables
:: !!!! How do I get around this ... ?
echo echo $PWD

2 番目の echo コマンドの前に ^ (キャレット) を付けるとうまくいくと思いましたが、うまくいきませんでした。解決策は何ですか?

4

2 に答える 2

3

やってみました

@エコー エコー %TMP%

戻った

echo C:\Users\Spike\AppData\Local\Temp

問題は $PWD ほどエコーではなかったと思います。%% は $ の DOS です。

于 2010-03-09T23:18:57.850 に答える
2

これは、Windows XP で動作します。

@echo off
:: inside the .BAT file ..
:: check we are in the right directory
echo pwd > command.txt
:: get the shell to echo its environment variables
:: !!!! How do I get around this ... ?
echo echo ^$PWD >>command.txt

出力

C:\test>test.bat

C:\test>more command.txt
pwd
echo $PWD
于 2010-03-09T23:46:46.243 に答える