Solved

Error on vb script

Posted on 2014-09-09
2
206 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
2 Comments
 
LVL 58

Expert Comment

by:Gary
ID: 40313052
Missing an opening "

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

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
A short article about problems I had with the new location API and permissions in Marshmallow
The viewer will learn how to count occurrences of each item in an array.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

830 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