Jump to content

condion using run(@compSpec.....)


Recommended Posts

please forgive my title i meant to say condition using run(@compSpec.....)

my code first checks if vnc server process is running or not. if it is nor running then it executes the code below. What I need now is a further condition that tests if Run(@ComSpec & " /c " & 'net start vnc server', "", @SW_HIDE) worked or not. if it fails to start vnc server then it records to the log file that script failed to start vnc services....thank you for your help....

Run(@ComSpec & " /c " & 'net start vnc server', "", @SW_HIDE)
Edited by goodbyeplanet
Link to comment
Share on other sites

From the Help file - Run:

Return Value

Success: The PID of the process that was launched.

Failure: Returns 0 and sets @error to non-zero.

If the return of the Run command is 0 then it failed, otherwise it will return a PID = success

If Run(@ComSpec & " /c " & 'net start vnc server', "", @SW_HIDE) = 0 Then

Write your log record here

EndIf

Edited by enaiman

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Link to comment
Share on other sites

From the Help file - Run:

If the return of the Run command is 0 then it failed, otherwise it will return a PID = success

If Run(@ComSpec & " /c " & 'net start vnc server', "", @SW_HIDE) = 0 Then

Write your log record here

EndIf

I just had that conversation an hour or so ago. The problem is that it is returning the PID from the @Comspec (or the net command). Check thread and adapt
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...