Setting environment variables for Windows cmd temporarily, to run a program, in a single line?
--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Ominous Technology Looping
--
Chapters
00:00 Setting Environment Variables For Windows Cmd Temporarily, To Run A Program, In A Single Line?
01:43 Answer 1 Score 4
02:03 Accepted Answer Score 9
02:17 Thank you
--
Full question
https://superuser.com/questions/1405650/...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#windows #commandline #environmentvariables
#avk47
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Ominous Technology Looping
--
Chapters
00:00 Setting Environment Variables For Windows Cmd Temporarily, To Run A Program, In A Single Line?
01:43 Answer 1 Score 4
02:03 Accepted Answer Score 9
02:17 Thank you
--
Full question
https://superuser.com/questions/1405650/...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#windows #commandline #environmentvariables
#avk47
ACCEPTED ANSWER
Score 9
You could run a batch file with a setlocal
or on cmd line start another cmd.exe which inherits the current environment but changes are volatile.
cmd /c "SET MYVAR=1&myprogram.exe"
ANSWER 2
Score 4
Try this command:
set Foo=bar & abc.exe & set Foo=
This command does:
- Set
Foo
variable withbar
value. - Run
abc.exe
command. - Unset
Foo
variable by adding blank value.