Celeb Glow
general | March 15, 2026

How to use relative paths on windows CMD?

OSX I can do this:

someCommand -someOtherParameter ../../../../../ThisFileIsNeeded -yetAnotherParameter

When I try to do the same thing on Windows it yields:

"The system cannot find the file specified"

because the result path is something like:

c:\myFolder\otherFolder\IamHere\..\..\..\..\ThisFileIsNeeded

How can I write relative paths for windows cmd?

1 Answer

Relative paths

Paths, and relative ones, work very similar to what you have in OS X/macOS.

  • Windows uses "\", not "/".
  • Basically ".." is one level higher.

Example

If you are located in "c:\dev\repos\repo1" and you want to do something with a file located in "c:\dev\bin\" (example below for PowerShell).

C:\dev\repos\repo1> Start-Process ..\..\bin\my_executable.exe

Command line above in words:

Start a process using the file my_executable.exe found (with starting point in the current directory (relative path)) by going two directories back up and then down in to directory bin.


It seems to me that you do know how relative paths work. Reply with exact commands so that I can reproduce what you're trying.

5

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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