Hi @Pascal St-Pierre ,
pleas try this:
$filepath = "C:\Users\$Env:USERNAME\Documents"
cd $filepath
----------
(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)
Regards
Andreas Baumgarten
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I have a PowerShell script that I am running to do some updates to some distribution lists. Right now in my script I have it set to output the .CSV files to the following folder:
c:\user\stpierrepa\documents
I am looking to have this path change based on the user that is running the script, so if I use my admin account the path would automatically switch to the following:
c:\users\adminstpierrepa\documents
I have tried using the %userprofile% but it gives me an error, and have looked up different variants so far without much luck. So I am reaching out to the community for some pointers on how to do this.
Thank you in advance for your help.
Pascal
Hi @Pascal St-Pierre ,
pleas try this:
$filepath = "C:\Users\$Env:USERNAME\Documents"
cd $filepath
----------
(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)
Regards
Andreas Baumgarten