Certain syntax not agreeing with TIDAL scheduler - Ideas?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
SIMMS7400
Posts: 543
Joined: 07 Jan 2016 07:47

Certain syntax not agreeing with TIDAL scheduler - Ideas?

#1 Post by SIMMS7400 » 28 Feb 2017 07:24

Hi Folks -

I use TIDAL scheduler at work quite a bit. However, it doesn't like the PING / SLEEP / TIMEOUT commands in batch files. Has anyone seen this before? Any tricks to get around it?

For instance :

Code: Select all

@ECHO OFF
::-- Run as Administrator --::
:-------------------------------------
::--  Check for permissions --::
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"

::-- If error flag set, we do not have admin --::
if '%errorlevel%' NEQ '0' (
    echo Requesting administrative privileges...
    goto UACPrompt
) else ( goto gotAdmin )

:UACPrompt
    echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
    set params = %*:"=""
    echo UAC.ShellExecute "cmd.exe", "/c %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs"

    "%temp%\getadmin.vbs"
    del "%temp%\getadmin.vbs"
    exit /B

:gotAdmin
    pushd "%CD%"
    CD /D "%~dp0"
:--------------------------------------

::-- Pause for 3 minutes if executed by a scheduler --::
   ::-- If manual execution, give ample time prior to executing START script --::
FOR /F "tokens=2" %%# IN ("%cmdcmdline%") DO IF /i "%%#" EQU "/c" GOTO MANUAL
 
PING -n 180 127.0.0.1>nul
 
:MANUAL

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::-- Script Name: Start_EPM_Services.cmd                                     --::
::--                                                                         --::
::-- Description: This script Starts EPM Services                            --::
::                                                                           --::
::-- Calls:       SafeStopStartRestart.cmd                                   --::


The scheuleder fails on this: PING -n 180 127.0.0.1>nul

And throws and error saying > was unexpected at this time. However, when I remove >NUL, it still fails.

Strange.
Thanks!
Last edited by SIMMS7400 on 28 Feb 2017 09:05, edited 1 time in total.

Squashman
Expert
Posts: 4471
Joined: 23 Dec 2011 13:59

Re: PING / SLEEP /TIMEOUT commands not agreeing with TIDAL scheduler

#2 Post by Squashman » 28 Feb 2017 07:34

You have not specified what happens when you use SLEEP or TIMEOUT. Also, SLEEP and TIMEOUT are specific to certain versions of Windows.

SIMMS7400
Posts: 543
Joined: 07 Jan 2016 07:47

Re: PING / SLEEP /TIMEOUT commands not agreeing with TIDAL scheduler

#3 Post by SIMMS7400 » 28 Feb 2017 08:16

Hi Squash -

I feel silly, I was doing too much testing at one time.

So, there problem area is this:

Code: Select all

::-- Pause for 3 minutes if NOT executed manually ^(double-clicked^) --::
   ::-- If manual execution, give ample time prior to executing START script --::
FOR /F "tokens=2" %%# IN ("%cmdcmdline%") DO IF /i "%%#" EQU "/c" GOTO MANUAL
 
PING -n 180 127.0.0.1>nul
 
:MANUAL


PING / SLEEP / TIMEOUT do work. However, when I remove the PING command ( or SLEEP or TIMEOUT), I'm getting the following errors in the scheduling tool:

Code: Select all

> was unexpected at this time.
Connecting to hyper-util-prd...



Is my syntax incorrect? I dont know why its giving me > error as I see no redirection.

Thanks!

Post Reply