windows - 使开始/优先级(在批处理文件中)工作并将参数从一个批处理文件传递到另一个批处理文件
问题描述
我有一个批处理(实际上是两个,一个简单,一个复杂)文件,用于将 IR 命令发送到 HTPC 的冲击波。我自己没有编写批处理文件;太复杂了。两个通道更改批处理文件都有输入参数,一个只有 {channel}(=3 个数字)和更复杂的 {channel} 和 {IRdefinition}(一个 IR 定义文件)。我不能直接从调用应用程序(NextPVR)调用启动/优先级,这就是我需要使用两个批次的原因。
我只需要以高优先级运行 channel_change 批次。我尝试从一个简单的 starter_batch 调用 channel_changeing 批处理,如下所示:
GXPC4312H_StarterUUTX.bat
REM
SET command=GXPC4312H_UUTX.bat
REM SET command=GXPC4312H_Changer.bat for the complex one
start "" /REALTIME /B %command%
REM
简单频道转换器批处理 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
)
复杂通道转换器批处理 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
我使用一个 {channel} 参数从提升的命令提示符运行第一个,例如 115
我得到的是一个永远不会结束并抛出很多错误的批处理文件。似乎没有将通道号参数从起始批次传递到更改批次,但我读到它们被传递了?
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
当我使用两个参数 {channel} {IRDef.ir} 例如 115 GXPC4312H.ir 运行第二个启动器时,我得到了一个简单的错误
"The syntax of the command is incorrect"
我不太确定这里发生了什么,因为我已经继承了这些批处理文件(并且只修改了路径名和 IRdef 文件)。虽然我可以在某种程度上遵循其中的逻辑,但我正在努力解决错误。
资源:
- 开始“名称”/优先级“PATH .. 可执行文件”--arguments https://www.tenforums.com/tutorials/89548-set-cpu-process-priority-applications-windows-10-a.html#option4
- 我在这里读过使用 call 但我相信我需要使用 start 因为我希望批处理文件以高优先级运行? 第一次调用其他批处理脚本后批处理脚本停止
- 我知道你也可以使用 wmic,但我在这里读过不要使用 wmic,因为它不可靠(我很高兴使用 start "" /priority switch anwyay)。 https://superuser.com/questions/620724/changeing-windows-process-priority-via-command-line?noredirect=1&lq=1
- 变量从一个批处理文件传递到另一个。 如何将变量从一个批处理文件传递到另一个批处理文件?
解决方案
推荐阅读
- laravel - 将 laravel 调用到 chamilo(lms) 的肥皂错误
- python - 如何避免获取 ftplib.error_perm: 550 该进程无法访问该文件,因为它正被另一个进程使用?
- scala - 抑制特定范围内未使用的警告
- python - 模拟在列表的追加中使用的函数调用
- c++ - 用新向量中的对应值替换向量中的所有奇数值
- python-3.x - 如何将控制台输出为 csv
- mysql - 如何在 MYSQL 中将新文件夹“插入”到路径中?
- ios - 如何在 UICollectionView、Swift 5、Xcode 的行下添加行
- python - python中COM对象的正确类型提示是什么?
- java - 将嵌套 JSON 表示为 neo4j (SDN) 中的节点