15

Is there a way to add the current (the one you're currently in) directory to PATH without having to type it manually; for example

f:\TEMP\Add directory f:\TEMP to PATH without having to do

set PATH=%PATH%;f:\TEMP;
2
  • Are you looking to add a specific directory to PATH once so you can use it in the future, or are you looking to add every directory you go to into PATH whenever you go into that directory?
    – nehcsivart
    Commented Sep 20, 2015 at 14:16
  • @tchen - I'm looking for a way to add the directory I'm currently inside to PATH, but without having to type its name.
    – Rook
    Commented Sep 20, 2015 at 14:19

1 Answer 1

23

%CD% expands to current directory.

So you can use:

set PATH=%PATH%;%CD%
3
  • Exactly what I've been looking for. ge0rdi, thank you.
    – Rook
    Commented Sep 20, 2015 at 14:20
  • I get, bash: fg: %CD%: no such job. Commented Mar 20, 2017 at 1:49
  • 2
    @Web_Designer this is for Windows. You can do it in a bash shell (*nix) with `export PATH=".:$PATH" although it is a little bit of a security vulnerability and generally frowned upon.
    – zbeekman
    Commented Aug 9, 2018 at 2:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .