У меня есть следующий сценарий PowerShell для проверки моих репозиториев SVN:
$SVNAdminDir = 'C:\Program Files (x86)\VisualSVN Server\bin';
$RepositoryDir = 'C:\My Repositories\App1';
$_cmd = "`"$SVNAdminDir`\svnadmin`" verify `"$RepositoryDir`"";
Write-Host $_cmd; # Copying this into the command prompt runs without an issue...
cmd.exe /c $_cmd; # It's when I try to execute the command from PS that I get the error.
Но когда я пытаюсь выполнить его, я получаю следующее сообщение об ошибке:
cmd.exe : 'C:\Program' is not recognized as an internal or external command,
At line:5 char:12
+ cmd.exe <<<< /c $_cmd;
+ CategoryInfo : NotSpecified: ('C:\Program' is...ternal command,:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
operable program or batch file.
Поскольку я по существу устанавливаю $ cmd = '"C: \ Program Files (x86) \ VisualSVN Server \ bin \ svnadmin", проверьте "C: \ My Repositories \ App1"';
с двойные кавычки внутри одинарных, я ожидал места в C: \ Program Files (x86) \ ... должна быть передана правильно.
Я подозреваю, что есть что-то тривиальное со строкой, которую мне не хватает ...