4roi
asked on
Use PowerShell Variables
Hello everyone. This is a pretty basic question, but I am new to Powershell for the most part and have been struggling.. I am trying to utilize some of the environment variables to draft a automated task. For example I would like to create a "testing" folder within all user profiles.
So when I run the Get-ChildItem Env: command, I see that "USERPROFILE" is listed as an evironment variable. Great! Just like a Command Prompt/DOS script right? Wrong. when I run this command:
PS c:\Users\UserName> md %USERPROFILE%\testing
It creates a folder like this:
c:\Users\UserName\%USERPRO FILE%\test ing
Well that isn't what I wanted.... Hmm. What am I missing here in the PowerShell world?
So when I run the Get-ChildItem Env: command, I see that "USERPROFILE" is listed as an evironment variable. Great! Just like a Command Prompt/DOS script right? Wrong. when I run this command:
PS c:\Users\UserName> md %USERPROFILE%\testing
It creates a folder like this:
c:\Users\UserName\%USERPRO
Well that isn't what I wanted.... Hmm. What am I missing here in the PowerShell world?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER