3

例として、次の名前のバッチ ファイルを作成しましたconcatenate.bat

@echo off
set foo=%1\bar
echo %foo%

私が走るときconcatenate.bat "C:\somewhere\with spaces"

foo に出力させたい: "C:\somewhere\with spaces\bar"

しかし、代わりに私は得る: "C:\somewhere\with spaces"\bar


私も試しました:set "foo=%1\bar"

どの出力:"C:\somewhere\with spaces"\bar


これを行う正しい方法は何ですか?

4

1 に答える 1

7
@echo off
set foo="%~1\bar"
echo %foo%
于 2012-11-15T17:02:17.190 に答える