R
raffelm
I'm struggling to find a way to include long path names in a command
line argument string that I have to build at runtime.
I need to create a string like -o:"c:\my documents\my file.txt".
Everything I have tried so far causes the program I am calling to fail
(I know it can accept long file names as I have tried it from the
cmdline).
The problem I am having is using the Format command and getting "
(quotes) around the my file name.
I have tried
string strArgs = String.Format(@"-o:{3}{0}{3}",
strPatchName,
'"');
and
string strArgs = String.Format("-o:\"{0}\"",
strPatchName);
and
string strArgs = String.Format(@"-o:""{0}""",
strPatchName);
and none of it gives me a string like -o:"c:\my documents\my
file.txt". I keep getting strings like -o:\"c:\\my documents\\my
file.txt\" which doesnt work.
I've thought about converting the long file name to a short pathname,
which would work if the file exists (and in most cases it will not).
So, I am wondering if there is a better way to get this right?
Thnx
Matt
line argument string that I have to build at runtime.
I need to create a string like -o:"c:\my documents\my file.txt".
Everything I have tried so far causes the program I am calling to fail
(I know it can accept long file names as I have tried it from the
cmdline).
The problem I am having is using the Format command and getting "
(quotes) around the my file name.
I have tried
string strArgs = String.Format(@"-o:{3}{0}{3}",
strPatchName,
'"');
and
string strArgs = String.Format("-o:\"{0}\"",
strPatchName);
and
string strArgs = String.Format(@"-o:""{0}""",
strPatchName);
and none of it gives me a string like -o:"c:\my documents\my
file.txt". I keep getting strings like -o:\"c:\\my documents\\my
file.txt\" which doesnt work.
I've thought about converting the long file name to a short pathname,
which would work if the file exists (and in most cases it will not).
So, I am wondering if there is a better way to get this right?
Thnx
Matt