none
double/four qoutes in shell command

    Question

  • 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 the

    Shell("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
    Monday, January 07, 2013 5:54 PM

Answers

  • 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 6:26 PM

All replies