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!