Solved

psexec and vb.net

Posted on 2014-10-18
2
185 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 69

Accepted Solution

by:
Éric Moreau earned 500 total points
Comment Utility
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
Comment Utility
thank you!!!
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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 user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

763 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now