double/four qoutes in shell command
-
Monday, January 07, 2013 5:54 PM
Hi,
I have this simple command that uses Psexec to remotely call an exe.
If I use this from my local machine (from command line) it works fine :
psexec \\ZSW-ROBCON - i "C:\Program Files (x86)\Time Reminder Installer\Time Reminder.exe"
But I'm trying to use it from vb.net - I know it's a doubls qoute issue. But I can't figure out how to fix it.
Here's what I have in vb:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Shell("C:\pstools\psexec \\ZSW-ROBCON - i C:\Program Files (x86)\Time Reminder Installer\Time Reminder.exe") End Sub
I know if I could get theShell("C:\pstools\psexec \\ZSW-ROBCON - i C:\Program Files (x86)\Time Reminder Installer\Time Reminder.exe")
in parends like -
Shell("C:\pstools\psexec \\ZSW-ROBCON - i "C:\Program Files (x86)\Time Reminder Installer\Time Reminder.exe")
It would work, but the above errors because I'm not wrapping qoutes the correct way.
qeqw
- Edited by rqwew Monday, January 07, 2013 5:54 PM
All Replies
-
Monday, January 07, 2013 6:26 PM
In vbnet a real double quote inside a string must use two double quotes. so there are three double quotes at the end of the string.
Shell("C:\pstools\psexec \\ZSW-ROBCON - i ""C:\Program Files (x86)\Time Reminder Installer\Time Reminder.exe""")
jdweng
- Marked As Answer by rqwew Monday, January 07, 2013 7:20 PM
-
Monday, January 07, 2013 7:20 PMAwesome...thanks Joel!
qeqw
-
Monday, January 07, 2013 7:21 PM
You may also want to consider using Process.Start and the ProcessStartInfo Class with the Arguments property:
http://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo.aspx
Paul ~~~~ Microsoft MVP (Visual Basic)

