Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Visual basic command includes a <space>

Posted on 2009-05-04
2
Medium Priority
?
258 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 200 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

721 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