Set statement not working
Posted: 26 Dec 2019 23:04
I originally didn't have the single quotes on these set statements and the @echo. >>%~f0.txt worked
They worked fine except when it got to the "If defined" line. And it ended the script.
I tried putting double quotes in place of the single quotes and it still ended the script.
Now nothing gets written to %~f0.txt and I would like it to.
What can I do to fix it?
They worked fine except when it got to the "If defined" line. And it ended the script.
I tried putting double quotes in place of the single quotes and it still ended the script.
Code: Select all
set 'FullTarget1=Docfxit 192.168.168.9'
set 'FullTarget2=DocfxitLT 192.168.168.7'
set 'FullTarget3=ErrolLT530 192.168.2.5'
set 'FullTarget4=CONSOLE2-I5 192.168.168.16'
@echo. %FullTarget1% >>%~f0.txt
@echo. %FullTarget2% >>%~f0.txt
@echo. %FullTarget3% >>%~f0.txt
If defined FullTarget4 (If /i not %FullTarget4%.=="". echo. %FullTarget4%>>%~f0.txt)
What can I do to fix it?