2010-03-09 33 views
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 

我想附加了一個^(插入第二echo命令)會工作,但不會。解決辦法是什麼?

回答

3

我只是想

@echo回聲%TMP%

其返回

回聲C:\用戶\穗\應用程序數據\本地的\ Temp

我認爲這個問題WASN」 t的回聲和$ PWD差不多。 %%是DOS的$。

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