Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Word command-line-arguments space issues

I want to pass parameters to winword in order to read it in my vsto addin by using Environment.GetCommandLineArgs().

If a parameter-value contains a space I'm not able to escape the strings.

This is working:

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

This is not working:

winword.exe /myVar1:"C:\folder with space\whatever1.doc" /myVar2:"C:\folder with space 2\somethingelese.txt" C:\example.doc
like image 829
wuhi Avatar asked Apr 22 '26 15:04

wuhi


1 Answers

Try with the following command :

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

If it still doesn't work, send us the content of the array returned by GetCommandLineArgs.

like image 140
Guillaume Avatar answered Apr 25 '26 05:04

Guillaume



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!