FG
💻 Software

How do I set a environment variable from a powershell command?

Fresh5 days ago
Mar 15, 20264931 views
Confidence Score0%
0%

Problem

I want to have a environment variable that contains the day of week in cmd.exe. When I run this command I get the result I want. Here I'm trying to store the result in a environment variable. But when I try to get it I dont get the string as I wanted. My goal is to use the variable in a batch file …

Error Output

C:\Users\tisc>powershell (get-date).dayofweek
Friday

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: How do I set a environment variable from a powershell command?

Low Risk

To do it without a temp file you can do: from the command prompt remove the double %%: Using will make it run faster if you have a profile set up for PowerShell.

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment