运行带有空格path的参数的问题

我需要运行命令:

certmgr.exe -add MyCert.cer -s -r localMachine trustedpublisher 

现在我遇到的问题是,certmgr.exe不在我的path。 我也不想把它添加到我的path。

好的,我当然可以这样做:

 set PATH=%PATH%;C:\Program Files (x86)\Microsoft Visual Studio 11.0 

certmgr.exe的path是上面的Microsoft Visual Studio 11.0path。

但我应该能够使用可执行文件的完整path运行该命令。

所以我尝试了以下几点:

 >"C:\Program Files (x86)\Microsoft Visual Studio 11.0\certmgr.exe" -add comodo.cer -s -r localMachine trustedpublisher '"C:\Program Files (x86)\Microsoft Visual Studio 11.0\certmgr.exe"' is not recognized as an internal or external command, operable program or batch file. >"..\..\..\Program Files (x86)\Microsoft Visual Studio 11.0\certmgr.exe" -add comodo.cer -s -r localMachine trustedpublisher '"..\..\..\Program Files (x86)\Microsoft Visual Studio 11.0\certmgr.exe"' is not recognized as an internal or external command, operable program or batch file. >start "C:\Program Files (x86)\Microsoft Visual Studio 11.0\certmgr.exe" -add comodo.cer -s -r localMachine trustedpublisher The system cannot find the file -add. >set THISPROG=C:\Program Files (x86)\Microsoft Visual Studio 11.0\certmgr.exe >%THISPROG% -add comodo.cer -s -r localMachine trustedpublisher 'C:\Program' is not recognized as an internal or external command, operable program or batch file. >"%THISPROG%" -add comodo.cer -s -r localMachine trustedpublisher '"C:\Program Files (x86)\Microsoft Visual Studio 11.0\certmgr.exe"' is not recognized as an internal or external command, operable program or batch file. 

我如何运行命令:

 "C:\Program Files (x86)\Microsoft Visual Studio 11.0\certmgr.exe" -add comodo.cer -s -r localMachine trustedpublisher 

而无需将“C:\ Program Files(x86)\ Microsoft Visual Studio 11.0添加到我的path中?

Solutions Collecting From Web of "运行带有空格path的参数的问题"

尝试这个 …

 set THISPROG="C:\Program Files (x86)\Microsoft Visual Studio 11.0\certmgr.exe" 

(注意路径附近的""

 %THISPROG% -add comodo.cer -s -r localMachine trustedpublisher 

我似乎无法找到你在我的Visual Studio文件夹中提到的文件,但我只是测试这种格式打开记事本中的文件。


在我的测试中,我有一个文件在C:\a.txt ,我用…

 set AAA="C:\Windows\System32\notepad.exe" %AAA% C:\a.txt