I want to add the possibility to use the above mentioned solution as input for command pipes which require slashes instead of backslashes.
I hit this while using jest under Windows, whereby jest requires slashes and Windows path autocompletion returns backslashes:
.\jest.cmd .\path\to\test <== Error; jest requires "/"
Instead I use:
.\jest.cmd (echo .\path\to\test | %{$_ -replace "\\", "/"})
which results to
.\jest.cmd ./path/to/test
Even multiple paths could be "transformed" by using an array (echo path1, path2, path3 | ...)
. For example to specify also a config file I use:
.\jest.cmd --config (echo .\path\to\config, .\path\to\test | %{$_.replace("\", "/")})
.\jest.cmd --config ./path/to/config ./path/to/test
The nice thing is that you still could use the native path autocompletion to navigate to your files.