Problems
Please check the following commands and their outputs!
D:tmp>@echo off
//// command 1
for /f "tokens=1,* delims==" %f in ('set') do set %f=
//// command 2
set
//// command 3
for /f "tokens=1,* delims==" %f in ('set') do echo %f
COMSPEC
CONDA_BAT
CONDA_EXE
CONDA_SHLVL
PATH
PATHEXT
PROMPT
- Command 1 is to unset all the variables
- Command 2 is to show the variables, and indeed there’s no output
- Command 3 is to show the variables one by one, and indeed there’re some variables
- Notice:
- the set command run in the sub-shell
- if a batch file run, the environment variables can be seen.
- When running on powershell, the environment variables are gone in the sub shell.
- Notice:
My Questions
How can I unset the above environment variables, in that the new program cannot see them?
- The above document already includes my tries.
- I also did on powershell, all the variables are gone in the new program.