Oct 21 2020 10:10 AM - edited Oct 21 2020 10:12 AM
I am trying to create a file in the localappdata location in powershell. i have tried using $env:localappdata but it just shows the localappdata location just like write-host C:\Users\%username%\AppData\Local. I want to go to that location but it cant be done like in cmd i can just do cd %localappdata%. My main goal is to create a file there and delete it at certain condition. How do I change directory to %localappdata% location?
Oct 21 2020 11:48 AM
Solutionif you want to change the current directory to go to AppData, try set-location $env:LOCALAPPDATA
if you want to write content to the folder
did you try something like this
New-Item -Path "$($env:LOCALAPPDATA)\NewContent.txt"
Oct 22 2020 10:58 AM
@farismalaeb Thank you, I never knew it was that simple :grinning_face_with_sweat: