Word命令行参数空间问题

我想通过使用Environment.GetCommandLineArgs()将参数传递给winword,以便在我的vsto插件中读取它。

如果参数值包含空格我无法转义字符串。

这是有效的:

winword.exe /myVar1:C:\folder\whatever1.doc /myVar2:C:\folder\somethingelese.txt C:\example.doc 

这不起作用:

 winword.exe /myVar1:"C:\folder with space\whatever1.doc" /myVar2:"C:\folder with space 2\somethingelese.txt" C:\example.doc 

尝试使用以下命令:

 winword.exe "/myVar1:C:\folder with space\whatever1.doc" "/myVar2:C:\folder with space 2\somethingelese.txt" C:\example.doc 

如果它仍然不起作用,请向我们发送GetCommandLineArgs返回的数组的内容。