我有一个批处理文件,调用一个用于刷新名为sfh_dm36x.exe的NAND芯片的程序,由于它的工作方式,该程序在初始刷新后挂起,手动执行时,我点击CTRL+C,然后重新运行命令,然后再次运行并结束(这是正常行为,出于某种原因)
目前我调用了一个名为"start.bat“的批处理文件,它运行了一个名为"runflash.bat”的新批处理文件,它启动了闪存过程,这将打开一个新的CMD窗口并运行程序,同时start.bat从20开始倒计时,然后杀死sfh_dm36x.exe和新产生的命令窗口,然后它调用第二个名为runflash1.bat的批处理文件,第二个批处理文件结束,闪存结束。
start "JudRun" "runflash.bat"
timeout /t 20 >nul
taskkill /im sfh_dm36x.exe /f
taskkill /fi "WindowTitle eq JudRun"
cls
timeout /t 2 >nul
start "JudRun" "runflash1.bat"我正在寻找一些方法来将它转换成一个批处理文件,但找不到方法来做到这一点,如果我使用下面的代码,那么它将不会前进到任务杀死命令,因为sfh_dm36x.exe还没有完成。
set /P id=Enter Comport used for flashing:
sfh_DM36x.exe -nandflash -v -p "COM%id%" ubl1_editedByGaucho.img u-boot_modifiedByGaucho.img
taskkill /im sfh_dm36x.exe /f
set /P id=Enter Comport used for flashing:
sfh_DM36x.exe -nandflash -v -p "COM%id%" ubl1_editedByGaucho.img u-boot_modifiedByGaucho.img我在想一些计时器或者for next循环,一些允许使用任务杀的东西。希望问题足够清楚。
发布于 2020-07-17 13:40:19
Batch-file就像它的名字所说的那样。添加到文件中并按顺序运行的batches命令。因此,一个命令需要完成后,另一个命令才会运行。
当前您正在运行sfh_DM36x.exe,批处理正在等待它终止,以便可以运行下一行。因此,您需要在当前批处理窗口之外启动它。
title "Judrun"
set /P id=Enter Comport used for flashing:
start "" "sfh_DM36x.exe" -nandflash -v -p "COM%id%" ubl1_editedByGaucho.img u-boot_modifiedByGaucho.img
taskkill /im sfh_dm36x.exe /f
set /P id=Enter Comport used for flashing:
start "" "sfh_DM36x.exe" -nandflash -v -p "COM%id%" ubl1_editedByGaucho.img u- boot_modifiedByGaucho.imghttps://stackoverflow.com/questions/62943331
复制相似问题