Skip to content

Instantly share code, notes, and snippets.

@alvonx
alvonx / get_set_env.bat
Created September 13, 2023 19:24
get and set environment variable
@echo off
:: Define the name and value of the environment variable
set "MY_VARIABLE=MY_VALUE"
:: Set the environment variable using setx
setx MY_VARIABLE "%MY_VARIABLE%"
:: Display a message indicating that the variable has been set
echo Environment variable MY_VARIABLE set to %MY_VARIABLE%