I have a statement that sets a scheduled event, although I am having trouble wrapping the last part of the statement with the ' symbols.
Process.Start("schtasks.exe", @"/Create /SC DAILY /MO" + " \"" + comboBox2.Text + "\" " + @"/ST" + " \"" + comboBox1.Text + "\" " + @"/TN" + " \"" + textBox2.Text + "\" " + @"/TR ""C:\Program Files\test\scan.exe"" " + textBox3.Text);
I am trying to get textBox3.Text as follows:
'textBox3.Text'
您也可以使用String.Format
String.Format("Blah blah '{0}'", textBox3.Text);
只需将'放在双引号中。
... + "'" + textBox3.Text + "'"
Process.Start("schtasks.exe",
string.Format(
@"/Create /SC DAILY /MO ""{0}"" /ST ""{1}"" /TN ""{2}"" /TR ""C:\Program Files\test\scan.exe"" {3}",
comboBox2.Text, comboBox1.Text,
textBox2.Text, textBox3.Text));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.