Solved

Error on vb script

Posted on 2014-09-09
2
205 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 83

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

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.
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

786 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