Solved

Visual basic command includes a <space>

Posted on 2009-05-04
2
255 Views
Last Modified: 2013-11-25
I have the following line of code in a VBS script.

       WshShell.Run """c:\perl2.exe W_router.pl"""

The script host error is "file not found".

This command run as:

       c:\perl2.exe W_router.pl

from the command line succeeds. Clearly it is the space that is the problem. What to do?
0
Comment
Question by:HilltownHealthCenter
[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 6

Expert Comment

by:RPCIT
ID: 24296765
Try

Dim runCmd As String
runCmd = "c:\perl2.exe W_router.pl"
WshShell.Run runCmd

I've had a little trouble (inconsistently) with VBS and passing commands with parameters.  but wrapping it in a string seems to help.  
0
 
LVL 27

Accepted Solution

by:
bluntTony earned 50 total points
ID: 24296799
Try using:
WshShell.Run "c:\perl2.exe W_router.pl"
I don't think you need the double quotes. The space signifies the start of the argument so it's OK. Encompassing it all in quotes is making the script look for a file call 'c:\perl2.exe W_router.pl', rather than a file called 'C:\perl2.exe' and an argument 'W_router.pl'.
0

Featured Post

Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
On July 14th 2015, Windows Server 2003 will become End of Support, leaving hundreds of thousands of servers around the world that still run this 12 year old operating system vulnerable and potentially out of compliance in many organisations around t…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

734 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