Let's say I execute the following in the CMD shell:
SET "FOO=bar"
Is there a way to undefine this variable, other than recycling the CMD shell?
The drop command is used to remove variables or observations from the dataset in memory. If you want to drop variables, use drop varlist. If you want to drop observations, use drop with an if or an in qualifier or both.
Delete Environment Variables You need to just use the unset command with the variable name to delete it. This command will remove the variable permanently.
Yes, you can unset it with
set FOO=
Or explicitly using:
set "FOO="
Ensure no trailing extraneous (invisible) characters come after the =
sign. That is:
set FOO=
is different from set FOO=
.A secure way to unset the variable is to use also quotes, then there aren't problems with trailing spaces.
set FOO=bar echo %FOO% set "FOO=" text after the last quote is ignored echo %FOO%
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