In my powershell profile, I set the line to my C: drive: set-location c:\. However, I used to use my path variable github to jump to my github folder. This worked on command line, and my other non cd commands work on Powershell, just not this one.

:: move from user space to github folder

@echo off
cd users
cd giaco
cd documents
cd github

It simply ignores the command:


However, when I use another command:

jekyll build

It works fine.

How can I fix this?


  • Use instead cd /d "C:\users\giaco\documents\github" if the current location isn't where you expect it, all your relative cd commands don't work. – LotPings Mar 29 '19 at 16:35
  • @LotPings Thanks, however isn't working: imgur.com/a/k2ON2R6 still in the same directory. Thanks – Giacomo Mar 29 '19 at 16:39
  • Possible duplicate of Change directory in batch file with PowerShell – LotPings Mar 29 '19 at 16:43
  • 1
    You simply can't change the current location in powershell from a spawned batch, after closing the batch the cd doesn't persist. Why don't issue a Set-Location "C:\users\giaco\documents\github" in powershell? – LotPings Mar 29 '19 at 16:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.