Solved

psexec and vb.net

Posted on 2014-10-18
2
196 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Import MySQL data into MS Access using VB.Net interface 5 52
MYSQL responding very slow 3 50
ModalPopup  question 22 38
Adjust the codes 3 31
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This video teaches viewers about errors in exception handling.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

749 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