2017-01-30 9 views
0

愚かな質問で申し訳ありませんが、正しくcmdコマンドをバッチコマンドに30分変換してみてください。私は、変数へのパスをレンダリングしたい、バッチファイルでcmdのコマンドをバッチスクリプトのコマンドに変換する方法

"C:\Program Files (x86)\SmartBear\TestComplete 12\Bin\TestComplete.exe" "C:\Users\Administrator\Documents\TestComplete 12 Projects\TestProject1\TestProject1.pjs" /r p:TestProject1 /e 

:私はcmdのworklyコマンドを持っています。例について:

'/r' is not recognized as an internal or external command, operable program or batch file. 

私が使用:

call "C:\Program Files (x86)\SmartBear\TestComplete 12\Bin\TestComplete.exe" "C:\Users\Administrator\Documents\TestComplete 12 Projects\TestProject1\TestProject1.pjs" /r p:TestProject1 /e 

すべての作業

私は私のバッチを実行してみてください
set testCompleteDirectiore_volBat = C:\Program Files (x86)\SmartBear\TestComplete 12\Bin\TestComplete.exe 
set testCompleteProjectDirectory_volBat = C:\Users\Administrator\Documents\TestComplete 12 Projects\TestProject1\TestProject1.pjs 
set nameProject_volBat = TestProject 
call %testCompleteDirectiore_volBat% %testCompleteProjectDirectory_volBat% /r p:%nameProject_volBat% /e 

は、私は例外を取得します。どこで私の間違い?

答えて

0

を試してみてください=周辺のスペースを削除しsetコマンドと使用中の等号次のように二重引用符を使用します。

set "testCompleteDirectiore_volBat=C:\Program Files (x86)\SmartBear\TestComplete 12\Bin\TestComplete.exe" 
set "testCompleteProjectDirectory_volBat=C:\Users\Administrator\Documents\TestComplete 12 Projects\TestProject1\TestProject1.pjs" 
set "nameProject_volBat=TestProject" 
call "%testCompleteDirectiore_volBat%" "%testCompleteProjectDirectory_volBat%" /r p:%nameProject_volBat% /e 

そうでない場合=から残された空間は、右=から変数名及び空間における末尾の文字は、例えば、変数値の先頭文字になりなります

        ↓ 
set testCompleteDirectiore_volBat = C:\Program Files (x86)\SmartBear\TestComplete 12\Bin\TestComplete.exe 
            ↑ 
            ↓ 
echo "%testCompleteDirectiore_volBat %" 
" C:\Program Files (x86)\SmartBear\TestComplete 12\Bin\TestComplete.exe" 
↑ 
+0

ありがとう、本当の発言です! –

0

前と「=」の後に代入演算子のスペースを削除しようとする、すなわち 代わり

set var1 = someval1 

のは

set var1=someval1 
関連する問題