I have a batch file and it's content is:
SETLOCAL enabledelayedexpansion
SET /A FT=500
FOR /F "skip=1 tokens=1-6" %%A IN ('START "" /wait WMIC Path Win32_LocalTime Get Day^,Hour^,Minute^,Month^,Second^,Year
/Format:table ') DO (
IF NOT !FT!==500 GOTO proceed
SET FD=%%F-%%D-%%A
SET FT=%%B:%%C:%%E
:proceed
SET /A FX="DS"
)
echo %FD% %FT% : %* >> "%LOGFILE%"
endlocal
Initially the line
FOR /F "skip=1 tokens=1-6" %%A IN ('START "" /wait WMIC Path Win32_LocalTime Get Day^,Hour^,Minute^,Month^,Second^,Year
/Format:table ')
was
FOR /F "skip=1 tokens=1-6" %%A IN ('WMIC Path Win32_LocalTime Get Day^,Hour^,Minute^,Month^,Second^,Year
/Format:table ')
but as running the WMIC command within the batch caused the process to hang therefore I thought of running WMIC command on a new CMD windows and that seems to solve the hang issue, but now the content of the child windows running the WMIC command is not passed to the parent window. (i.e) The output to the log file is just "500" (Value of FT) and not the value of FT that is changed inside in the For loop, due to some reason it just skips the for loop.
Any idea or suggestion why this occurs?
I will really appreciate any suggestion.
Thanks a ton in advance.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…