P
pantagruel
Hi,
I'm starting a new process and passing it some arguments to look at a
folder that I have created. The folder gets created correctly. The
arguments are read from an xml file saved with ansi encoding (the xml
file works fine so that is not the problem), but with certain strings
that I expand via a regex replace, so that for example if I have the
following arguments:
<command>"%%FileName%" /O="%%OutputFilesFolder%"</command>
this gets read into a variable unexpandedcommand
and I run
foreach (KeyValuePair<string, string> kvp in SettingsDictionary)
{
Replacementkey = "%%" + kvp.Key + "%";
Unexpandedcommand =
Regex.Replace(Unexpandedcommand, Replacementkey, kvp.Value);
}
where the command %%FileName% gets replaced by the value of FileName
in my Dictionary and so forth.
The expanded result gets passed as an argument to the application, and
I also write it to the event log:
"C:\Copy of test2.doc" /O="C:\Copy of test2_files"
Now the problem is when I pass this argument via StartInfo.Arguments I
get nothing out of the process, it just exits. No error from the
process either. But when I start the command line and call the process
with these arguments that I put in my event log it works fine.
I figure it has to be an encoding problem somewhere among the various
possible encodings and passings of strings going on. But I am stumped
as to which one it could be.
So uh, the phrase I'm looking for is: HELP!!!!
I'm starting a new process and passing it some arguments to look at a
folder that I have created. The folder gets created correctly. The
arguments are read from an xml file saved with ansi encoding (the xml
file works fine so that is not the problem), but with certain strings
that I expand via a regex replace, so that for example if I have the
following arguments:
<command>"%%FileName%" /O="%%OutputFilesFolder%"</command>
this gets read into a variable unexpandedcommand
and I run
foreach (KeyValuePair<string, string> kvp in SettingsDictionary)
{
Replacementkey = "%%" + kvp.Key + "%";
Unexpandedcommand =
Regex.Replace(Unexpandedcommand, Replacementkey, kvp.Value);
}
where the command %%FileName% gets replaced by the value of FileName
in my Dictionary and so forth.
The expanded result gets passed as an argument to the application, and
I also write it to the event log:
"C:\Copy of test2.doc" /O="C:\Copy of test2_files"
Now the problem is when I pass this argument via StartInfo.Arguments I
get nothing out of the process, it just exits. No error from the
process either. But when I start the command line and call the process
with these arguments that I put in my event log it works fine.
I figure it has to be an encoding problem somewhere among the various
possible encodings and passings of strings going on. But I am stumped
as to which one it could be.
So uh, the phrase I'm looking for is: HELP!!!!