Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Visual basic command includes a <space>

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

Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

Question has a verified solution.

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

While rebooting windows server 2003 server , it's showing "active directory rebuilding indices please wait" at startup. It took a little while for this process to complete and once we logged on not all the services were started so another reboot is …
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

885 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