Solved

psexec and vb.net

Posted on 2014-10-18
2
191 Views
Last Modified: 2014-10-18
0

down vote

favorite


 


I made a small program which launches an .exe on a remote computer. When I run psexec from a CMD prompt, it works fine, when I run it in VB it errors with, "Cannot find file specified".

Dim targetpc As String = "192.168.1.3"
        Try
            Dim p As New Process()
            p.StartInfo.FileName = "C:\Users\johndoe\Desktop\PSTools\psexec.exe"
            p.StartInfo.Arguments = "\\" & targetpc & " " & "C:\Program Files (x86)\AVS4YOU\AVSAudioConverter\AVSAudioConverter.exe"
            p.Start()
            p.WaitForExit()
        Catch ex As Exception
            MsgBox("Shit didnt work")
        End Try

Open in new window


Is my concat string correct? What am I missing here.
0
Comment
Question by:derek7467
2 Comments
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 500 total points
ID: 40388719
the problem are the spaces in you arguments, you need to send them with double quotes around them:

 p.StartInfo.Arguments = "\\" & targetpc & " " & chr(34) & "C:\Program Files (x86)\AVS4YOU\AVSAudioConverter\AVSAudioConverter.exe" & chr(34)

Open in new window

0
 

Author Closing Comment

by:derek7467
ID: 40389248
thank you!!!
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
The viewer will learn how to implement Singleton Design Pattern in Java.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question