How to copy file path with forward slash?
Moderators: petermad, Stefan2, white, Hacker
How to copy file path with forward slash?
Hi,
I'm currently using an Hotkey to run the command cm_CopyFullNamesToClip.
In the clipboard the path is set with backslash (i.e c:\dev\file.txt).
I would like to have the path with forward slash (i.e. c:/dev/file.txt), Is there any settings that influence that?
I know i can write a script and put it in the shortcuts bar (something like this https://superuser.com/a/977847) but i want to use the keyboard shortcut to run it.
Does anybody have any idea how to achieve that?
Thank you!
I'm currently using an Hotkey to run the command cm_CopyFullNamesToClip.
In the clipboard the path is set with backslash (i.e c:\dev\file.txt).
I would like to have the path with forward slash (i.e. c:/dev/file.txt), Is there any settings that influence that?
I know i can write a script and put it in the shortcuts bar (something like this https://superuser.com/a/977847) but i want to use the keyboard shortcut to run it.
Does anybody have any idea how to achieve that?
Thank you!
Re: How to copy file path with forward slash?
Hi and welcome Laish.
Instead of into the shortcuts bar (buttonbar) you can write with that commands and parameters a "user defined command" (usercmd.ini),
which you can assign a keyboard shortcut to. (Configuration > Options > Misc.)
To aid you whit your actual task you can try to use an Add-on instead of an own script:
https://totalcmd.net/plugring/list2clip.html
https://www.ghisler.ch/board/viewtopic.php?t=1853
Or just use PowerShell:
viewtopic.php?t=48019
The forum is full with tips and tricks, just search for that keywords....
Instead of into the shortcuts bar (buttonbar) you can write with that commands and parameters a "user defined command" (usercmd.ini),
which you can assign a keyboard shortcut to. (Configuration > Options > Misc.)
To aid you whit your actual task you can try to use an Add-on instead of an own script:
https://totalcmd.net/plugring/list2clip.html
https://www.ghisler.ch/board/viewtopic.php?t=1853
Or just use PowerShell:
viewtopic.php?t=48019
The forum is full with tips and tricks, just search for that keywords....
Re: How to copy file path with forward slash?
I had the same question, and did not see a relevant option in List2Clip, so quickly coded a tiny CLI app that does gives forward slashes, and always quotes paths as well. That way I can easily copy it into code without worrying about escape characters and such.
https://github.com/visr/copy-paths-to-clipboard
https://github.com/visr/copy-paths-to-clipboard
Re: How to copy file path with forward slash?
A simple TotalCommander/Windows-native (PowerShell-based) solution, no third-party tools required:
user-command:
Now, the cm_CopyFullNamesToClip,em_toForwardSlash commands' chain does the job.
Example toolbar button:
Note:
To force enclosing each path in double quotes (as mentioned in the message above), put the user command as follows:
Then, the button becomes as follows:
NB:
The triple quotes are there to override the TotalCommander quotes' handling; in PowerShell itself,'"{0}"' would be enough.
user-command:
Code: Select all
[em_toForwardSlash]
cmd=pwsh -c (Get-Clipboard).replace('\','/')|Set-ClipboardExample toolbar button:
Code: Select all
TOTALCMD#BAR#DATA
cm_CopyFullNamesToClip,em_toForwardSlash
WCMICON2.DLL
Copy Names with Path to Clipboard /using forward slash path delimiters/
0
-1
To force enclosing each path in double quotes (as mentioned in the message above), put the user command as follows:
Code: Select all
[em_toForwardSlashQuoted]
cmd=pwsh -c (Get-Clipboard).replace('\','/').split([Environment]::NewLine)|foreach{'"""{0}"""' -f $_}|Set-ClipboardCode: Select all
TOTALCMD#BAR#DATA
cm_CopyFullNamesToClip,em_toForwardSlashQuoted
WCMICON2.DLL
Copy Names with Path to Clipboard /using forward slash path delimiters/ and "quoted"
0
-1
Code: Select all
'"""{0}"""'#278521 User License
Total Commander [always the latest version, including betas] x86/x64 on Win10 x64/Windows 11/Android 16
Total Commander [always the latest version, including betas] x86/x64 on Win10 x64/Windows 11/Android 16
Re: How to copy file path with forward slash?
Thanks, that looks like a good alternative.
I'd probably add "pwsh -NoProfile", since, depending on the profile, it can add a lot of latency.
Even with that the latency to start PowerShell is quite a bit higher than running the Rust CLI:
I'd probably add "pwsh -NoProfile", since, depending on the profile, it can add a lot of latency.
Even with that the latency to start PowerShell is quite a bit higher than running the Rust CLI:
Code: Select all
❯ hyperfine 'pwsh -c 1'
Benchmark 1: pwsh -c 1
Time (mean ± σ): 3.871 s ± 0.810 s [User: 2.977 s, System: 1.201 s]
Range (min … max): 2.317 s … 4.387 s 10 runs
❯ hyperfine 'pwsh -NoProfile -c 1'
Benchmark 1: pwsh -NoProfile -c 1
Time (mean ± σ): 331.8 ms ± 18.2 ms [User: 256.2 ms, System: 157.8 ms]
Range (min … max): 299.6 ms … 364.3 ms 10 runs
❯ hyperfine 'copy-paths-to-clipboard some_file'
Benchmark 1: copy-paths-to-clipboard some_file
Time (mean ± σ): 46.9 ms ± 6.8 ms [User: 11.6 ms, System: 12.5 ms]
Range (min … max): 34.5 ms … 59.4 ms 41 runs
Re: How to copy file path with forward slash?
2visr
Thank you too.
At least we give a user an option to decide what approach is better for them.
It's always great to have a choice.
Thank you too.
At least we give a user an option to decide what approach is better for them.
It's always great to have a choice.
#278521 User License
Total Commander [always the latest version, including betas] x86/x64 on Win10 x64/Windows 11/Android 16
Total Commander [always the latest version, including betas] x86/x64 on Win10 x64/Windows 11/Android 16
Re: How to copy file path with forward slash?
And I even know which one.beb wrote: 2026-02-15, 23:16 UTC At least we give a user an option to decide what approach is better for them.
FR: Copy names with full path - with / instead of \
Namen mit kompletten Pfad kopieren mit Forward Slashes
unix path of sftp connection to clipboard
Kopiere Namen mit Pfad in Zwischenablage mit '\', '\\' oder '/'
etc.
Overquoting is evil! 👎


