Link to home
Start Free TrialLog in
Avatar of 4roi
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\%USERPROFILE%\testing

Well that isn't what I wanted....  Hmm.  What am I missing here in the PowerShell world?
ASKER CERTIFIED SOLUTION
Avatar of Xaelian
Xaelian
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of 4roi
4roi

ASKER

Yep, That takes care of the immediate need.  It should also put me in the right direction for other commands.  Thank you!