How to copy the file path with escaped path separator?

Viewed 328

My OS is windows. File path copied when right click the file and choose the "Copy Relative Path" item from the menu.

examples\53407041\index.jsx

I want to copy the file path with escaped path separator:

examples\\53407041\\index.jsx

How can I do it? I found a related issue.

1 Answers

I've been following that issue for awhile and it has been resolved with a setting (it works in the Insiders Build now and should be in v1.59):

Explorer: Copy Relative Path Separator

with options

relative path separator setting

auto is the default. Try / to get the posix version. This only works on the Copy Relative Path editor tab and explorer file/folder context menu commands, not on Copy Path.

This won't escape the Windows backward slash as you specifically requested but the posix forward slash separator works much more broadly across OS's.

A new setting explorer.copyRelativePathSeparator allows to explicitly set the path separator to use when invoking the "Copy Relate Path" action. The available options are:

  • auto (default): Uses operating system specific path separation character
  • /: Use slash as path separation character
  • \\: Use backslash as path separation character
Related