Use the %username% variable with the PowerShell Set-Location Commandlet
powershell
Solution
# this will do
Set-Location -path "c:\users\$env:username\desktop"
# alternative syntax
cd "c:\users\$env:username\desktop"
Problem
In Windows File Explorer, we can use `C:\Users\%username%` but it doesn't work in PowerShell with `Set-Location`. Is there a way it can with one line? File Explorer - Success Set-Location - Fail ``` $set-location -path "c:\users\%username%" set-location : Cannot find path 'C:\users\%username%' because it does not exist. At line:1 char:1 + set-location -path "c:\users\%username%" + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ```