Solved

psexec and vb.net

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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

The purpose of this article is to demonstrate how we can use conditional statements using Python.
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.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

728 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