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?


Solution 1:

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.