Имам общ .bat файл, който чете файла status.xml и открива стойността на полето за състояние. След това този партиден файл се извиква от други пакетни файлове за откриване на стойността на състоянието. извикващите пакетни файлове изпращат името на файла към общия bat файл. Не мога да изпратя състоянието от общия пакетен файл към извикващите пакетни файлове. Може ли някой да помогне?
main batch file
-- will call the common bat file and send the file name and a variable as arguments
setlocal
call Common.bat c:\folderdir\files\status.xml val1
-- trying to print the status returned by the common bat file
echo [%val1%]
common batch file
@ECHO off
setlocal EnableDelayedExpansion
rem will loop through the file and read the value of the status tag
(for /F "delims=" %%a in (%1) do (
set "line=%%a"
set "newLine=!line:<Interface_status>=!"
set "newLine=!newLine:</Interface_status>=!"
if "!newLine!" neq "!line!" (
@echo Status is !newLine!
rem I want to send`enter code here` the value of newLine to the calling batch file
set %~2 = !newLine! <--this does not work
)
))