2

I have a batch (actually two, one simple, one complex) file to send IR commands to a blaster for HTPC. I didn't write the batch files myself; too complex. Both channel_changing batch files have input parameters, one just {channel} (=3 numbers) and the more complex {channel} and {IRdefinition} (an IR definition file). I cannot invoke start /priority from the calling App directly (NextPVR) which is why I need to use two batches.

All I need is to run the channel_changing batches at high priority. I've tried calling the channel_changing batch from a simple starter_batch as follows:

GXPC4312H_StarterUUTX.bat

REM SET command=GXPC4312H_UUTX.bat REM SET command=GXPC4312H_Changer.bat for the complex one start "" /REALTIME /B %command% REM 

Simple Channel Changer Batch GXPC4312H_UUTX.bat

@echo off cd C:\users\public\NPVR\ChanChg\ set "channel=%1" set "num=-1" :loop set /a num=num+1 call set "name2=%%channel:~%num%,1%%" if defined name2 ( uutx.exe -r3 -s10 -fGXPC4312H.ir %name2% echo %name2% goto :loop ) 

Complex Channel Changer Batch GXPC4312H_Changer.bat

set sleep=0 set loops=5 :WAIT IF EXIST C:\Users\Public\NPVR\ChanChg\usblock.dat (GOTO PING) ELSE (GOTO CC) :PING timeout 1 set /A sleep=%sleep%+1 IF %sleep% EQU %loops% GOTO ERROR GOTO WAIT :CC ECHO wait_lock > C:\Users\Public\NPVR\ChanChg\usblock.dat set input=%1 if not "%input:~0,1%" == "" C:\Users\Public\NPVR\ChanChg\uutx.exe -r3 -s200 -f%~dp0%2 %input:~0,1% if not "%input:~1,1%" == "" C:\Users\Public\NPVR\ChanChg\uutx.exe -r3 -s200 -f%~dp0%2 %input:~1,1% if not "%input:~2,1%" == "" C:\Users\Public\NPVR\ChanChg\uutx.exe -r3 -s200 -f%~dp0%2 %input:~2,1% if not "%input:~3,1%" == "" C:\Users\Public\NPVR\ChanChg\uutx.exe -r3 -s200 -f%~dp0%2 %input:~3,1% del C:\Users\Public\NPVR\ChanChg\usblock.dat exit :ERROR ECHO %DATE% %TIME% >> C:\Users\Public\NPVR\ChanChg\changer_error.log GOTO :CC 

I ran the first one with from an elevated command prompt with the one {channel} argument e.g. 115

What I got was a batch file that never ended and threw lots of errors. It seemed NOT to be passing the channel number parameter across from the starter batch to the changing batch but I read they were passed across?

Error: unable to find codeName '~0,1' in codeFile 'GXPC4312H.ir' ~0,1 Error: unable to find codeName '~1,1' in codeFile 'GXPC4312H.ir' ~1,1 Error: unable to find codeName '~2,1' in codeFile 'GXPC4312H.ir' ~2,1 etc etc 

When I ran the second starter with the TWO arguments {channel} {IRDef.ir} e.g. 115 GXPC4312H.ir I got a simple error that

"The syntax of the command is incorrect" 

I'm not really sure what is going on here, as I've sort of inherited these batch files (and modified just path names and IRdef Files). Whilst I can follow the logic in them to some degree, I am struggling to troubleshoot the errors.

resources:

5
  • wmic initialises on first run. So the first time it is run on a computer it must be done by an admin. After that anyone can use it. Some classes are provided by the manufacturer so not all computers have all classes (eg battery will work on a desktop, returning nothing). WMI is part of a multi platform standard (WBEM), has been around for 2 decades, and works fine. Commented Mar 12, 2019 at 4:59
  • Try changing in the starter script %command% to %command% %*. This will pass on starter script arguments to the other scripts. Commented Mar 12, 2019 at 8:33
  • Thanks Noodles, I didn't really want to start learning about wmic if I can help it; appreciate the note. Commented Mar 13, 2019 at 4:47
  • michael - brilliant - works!; so simple. cheers. k. Commented Mar 13, 2019 at 4:48
  • Just a follow-up - now does not exit from Complex Channel Changer Batch GXPC4312H_Changer.bat; OK for simple one. Commented Mar 13, 2019 at 4:54

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.