[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

vbs file error

Posted on 2011-09-22
2
Medium Priority
?
383 Views
Last Modified: 2012-05-12
I am trying to run a vbs file with the attached code.

However i get the error "The system cannot find the file specified"

on this line

objShell.Run "C:\program files\xarios\phone manager\phonemanager.exe"

The path does exist, i can go to the folder in command prompt and if i type in phonemanager.exe it opens.
sComputerName = "."
sTask = "Phonemanager.exe"
SET oWMI = GETOBJECT("winmgmts:" & "{impersonationLevel=impersonate}!\\" & sComputerName & "\root\cimv2")
SET cTask = oWMI.ExecQuery ("Select * from Win32_Process Where Name = '" & sTask & "'")
FOR EACH oTask in cTask
oTask.Terminate()
NEXT

msgbox "Stopping Service"

'Stop Service
strServiceName = "FwcAgent"
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colListOfServices = objWMIService.ExecQuery("Select * from Win32_Service Where Name ='" & strServiceName & "'")
For Each objService in colListOfServices
    objService.StopService()
Next

msgbox "Starting Xarios"


'strProgramPath = "C:\program files\xarios\phone manager\PhoneManager.exe"

set objShell = createobject("Wscript.Shell")

objShell.Run "C:\program files\xarios\phone manager\phonemanager.exe"

msgbox "paused"

wscript.sleep 3000

msgbox "Resumed"


'Start Service
strServiceName = "FwcAgent"
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colListOfServices = objWMIService.ExecQuery ("Select * from Win32_Service Where Name ='" & strServiceName & "'")
For Each objService in colListOfServices
    objService.StartService()
Next

Open in new window

0
Comment
Question by:CaptainGiblets
[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 65

Accepted Solution

by:
RobSampson earned 2000 total points
ID: 36579792
Hi, try it like this:
objShell.Run """C:\program files\xarios\phone manager\phonemanager.exe"""

or this
Set objFSO = CreateObject("Scripting.FileSystemObject")
strPhoneManager = objFSO.GetFile("C:\program files\xarios\phone manager\phonemanager.exe").ShortPath
objShell.Run strPhoneManager

Regards,

Rob.
0
 
LVL 6

Expert Comment

by:jorgedeoliveiraborges
ID: 36583842
There is a mistake in the use of quotes (").

objShell.Run " ""C:\program files\xarios\phone manager\phonemanager.exe"" "
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

When it comes to writing scripts for a Client/Server computing environment it is essential to consider some way of enabling the authentication functionality within a script. This sort of consideration mainly comes into the picture when we are dealin…
This is pretty cool.  The purpose of this VB Script is to help you document where JAR (Java ARchive) files and specifically java class files are located so that you can address issues seen with a client or that you can speak intelligently with a dev…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

649 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