Let's suppose that I have this code:
@echo off
set "var=value"
echo %var%
Now my question is: how to echo all variables set in the file?
I know you can do:
set
And it will display all variables. It displays:
ALLUSERSPROFILE=C:\ProgramData
APPDATA=C:\Users\foma\AppData\Roaming
CommonProgramFiles=C:\Program Files\Common Files
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
CommonProgramW6432=C:\Program Files\Common Files
...
I want that it displays:
var=value
I know I can do set var to display all variables starting with var, but in my case all my variables are "imported" from another batch file, so I don't know how the variable name starts.
Any ideas?
@echo off
setlocal
set>originalfile.txt
...
:: list environment changes
set|findstr /x /L /g:originalfile.txt
Should work - snapshot the starting values, then the findstr line should show you all changes made (except deletions) - at least in theory, this is just an on-the-fly suggestion.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With