我有一个脚本和一个配置文件。 在配置文件中主要有
SNFold_1="ORKI App 1.0.0.0219"
SNFile_1="8520010008_852001.T3A.pkg"
SNPrm_1="8520010008_852001.P3A.txt"
SNXML_1="852001.xml"
SNFold_2="iConnect REST Server 1.8.0.0017"
SNFile_2="8296831817_829683.P3A.pkg"
SNPrm_2="8296831817_829683.P3A.txt"
SNXML_2="829683.xml"
在主脚本文件中 我有以下代码:
@echo off
set SNFold_1=%SNFold_1:"=%
set SNFile_1=%SNFile_1:"=%
set SNPrm_1=%SNPrm_1:"=%
set SNXML_1=%SNXML_1:"=%
set SNFold_2=%SNFold_2:"=%
set SNFile_2=%SNFile_2:"=%
set SNPrm_2=%SNPrm_2:"=%
set SNXML_2=%SNXML_2:"=%
call:signFunc "%SNFold_1%" %SNFile_1% %SNPrm_1% %SNXML_1%
call:signFunc "%SNFold_2%" %SNFile_2% %SNPrm_2% %SNXML_2%
call:end
EXIT /B %ERRORLEVEL%
:signFunc - here starts Sign function
::::::::::::::::::::::::
:: prepare sign xml file
::::::::::::::::::::::::
cd %NEW_PACKAGE_BASE_PATH%\%NEW_PACKAGE_NAME%\%New_PACK_PTN%\Sign\xml
copy %NEW_PACKAGE_BASE_PATH%\%NEW_PACKAGE_NAME%\%New_PACK_PTN%\Sign\Temp\sample.xml .
Set "search=sign folder"
Set "replace=%~1"
Set "textfile=sample.xml"
Set "newfile=indesnew.txt"
(
For /F "Tokens=1* Delims=:" %%A In ('FindStr /N "^" "%textfile%"') Do (
If "%%B"=="" (
Echo=
) Else (
Set "line=%%B"
SetLocal EnableDelayedExpansion
Set "line=!line:%search%=%replace%!"
Echo=!line!
EndLocal
)
)
)>"%newfile%"
Del "%textfile%"
Ren "%newfile%" "%textfile%"
Set "search=sign binary file"
Set "replace=%~2"
Set "textfile=sample.xml"
Set "newfile=indesnew.txt"
(
For /F "Tokens=1* Delims=:" %%A In ('FindStr /N "^" "%textfile%"') Do (
If "%%B"=="" (
Echo=
) Else (
Set "line=%%B"
SetLocal EnableDelayedExpansion
Set "line=!line:%search%=%replace%!"
Echo=!line!
EndLocal
)
)
)>"%newfile%"
Del "%textfile%"
Ren "%newfile%" "%textfile%"
Set "search=sign parameter"
Set "replace=%~3"
Set "textfile=sample.xml"
Set "newfile=indesnew.txt"
(
For /F "Tokens=1* Delims=:" %%A In ('FindStr /N "^" "%textfile%"') Do (
If "%%B"=="" (
Echo=
) Else (
Set "line=%%B"
SetLocal EnableDelayedExpansion
Set "line=!line:%search%=%replace%!"
Echo=!line!
EndLocal
)
)
)>"%newfile%"
Del "%textfile%"
Ren "%newfile%" "%textfile%"
rename sample.xml %~4
cd "%SignKit_Path%"
call antCmdLine.bat %NEW_PACKAGE_BASE_PATH%\%NEW_PACKAGE_NAME%\%New_PACK_PTN%\Sign\xml\%~4 mockup
EXIT /B 0
:end
move "%SignKit_Path%\sign_file.log" "%NEW_PACKAGE_BASE_PATH%\%NEW_PACKAGE_NAME%\%New_PACK_PTN%\Sign\Temp"
@RD /S /Q "%NEW_PACKAGE_BASE_PATH%\%NEW_PACKAGE_NAME%\%New_PACK_PTN%\Sign\xml"
现在的问题是这个。 我在计算机上运行它,从
顺利运行然后第二个
但是当它在我的同事计算机中运行时,遇到了这个问题
运行良好 但是就在那之后,我暂停了一下,问按任意键继续... 按下任意键后,第二个循环就像 @echo on 一样运行,甚至挂起...
我和我的同事都在使用Windows 10
导致我的同事的计算机发生变化吗?
根据您的输入,我修改了两件事,并使它容易工作
2)然后在主脚本文件中
对于/ f“ tokens = 1-4 delims =”,(file.cfg)中的%% A会调用:signFunc %% A %% B %% C %% D
:signFunc-在这里启动签名功能
效果很好。