cmd /c
コマンドのフル パスのパスにスペースが含まれている可能性があり、その引数にもスペースが含まれている可能性がある場合、どのようにコマンドを渡す必要がありますか?
たとえば、"print arg.py" (引用符なし) は、フル パスにスペースが含まれている場合の代わりに、デモンストレーション目的でたまたまベース名にスペースが含まれているコマンドであり、適切な形式で引数を出力します。 .
c:\t>"print arg.py" "a b" "c d"
(a b)
(c d)
end
そのコマンドを に渡す際に失敗した試みのいくつかを次に示しますcmd /c
。
c:\t>cmd /c "print arg.py" "a b" "c d"
Unable to initialize device PRN
c:\t>cmd /c """print arg.py"" ""a b"" ""c d"""
Unable to initialize device PRN
c:\t>cmd /c "\"print arg.py\" \"a b\" \"c d\""
'\"print arg.py\"' is not recognized as an internal or external command,
operable program or batch file.