2

So I am more familiar with the

source

command in linux. Usually to set my environment variables I would run the following command.

source .env

with .env being a dot file.

How do I do this command in Powershell?

1
  • 1
    help about_scripts specifically the section on DOT SOURCING. Commented Apr 19, 2015 at 17:32

1 Answer 1

1

Create an environment file like EnvVarFile.ps1 with setting environment variable like

Set-Item Env:TestEnvVar "TestEnvVarValue"

Run ps1 file in the powershell like

. ./EnvVarFile.ps1

Use environment variables like

>$Env:TestEnvVar
TestEnvVarValue
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.