Solved

Error on vb script

Posted on 2014-09-09
2
209 Views
Last Modified: 2014-09-10
Hi

when i run this script i got error - Microsoft VBScript compilation error: Expected end of statement

i want to know how to fix this error


Set objShell = WScript.CreateObject ("WScript.Shell")

strservice = C:\Program Files\Tivoli\TSM\baclient\dsmcutil" inst scheduler /name:"TSM Client Scheduler" /node:%computername% /clientdir:"c:\Program Files\Tivoli\TSM\baclient" /optfile:"c:\program files\tivoli\tsm\baclient\dsm.opt" /password:%computername% /validate:yes /autostart:yes /startnow:yes

objShell.Run strservice
0
Comment
Question by:David Regev
[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 58

Expert Comment

by:Gary
ID: 40313052
Missing an opening "

strservice = C:\Program Files\Tivoli\TSM\baclient\dsmcutil"
0
 
LVL 85

Accepted Solution

by:
oBdA earned 500 total points
ID: 40313080
There are a few more double quotes missing, and VBScript can't expand environment variables directly:
Set objShell = WScript.CreateObject ("WScript.Shell")
strComputerName = objShell.ExpandEnvironmentStrings("%ComputerName%")
strService = Chr(34) & "C:\Program Files\Tivoli\TSM\baclient\dsmcutil" & Chr(34) & " inst scheduler /name:" & Chr(34) & "TSM Client Scheduler" & Chr(34) & " /node:" & strComputerName & " /clientdir:" & Chr(34) & "C:\Program Files\Tivoli\TSM\baclient" & Chr(34) & " /optfile:" & Chr(34) & "C:\Program Files\tivoli\tsm\baclient\dsm.opt" & Chr(34) & " /password:" & strComputerName & " /validate:yes /autostart:yes /startnow:yes"
objShell.Run strService

Open in new window

0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Progress

717 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