How to copy file path with forward slash?
Moderators: Stefan2, Hacker, petermad
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 beta] x86/x64 on Win10 x64/Windows 11/Android 17
Total Commander [always the latest version, including beta] x86/x64 on Win10 x64/Windows 11/Android 17
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 beta] x86/x64 on Win10 x64/Windows 11/Android 17
Total Commander [always the latest version, including beta] x86/x64 on Win10 x64/Windows 11/Android 17
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! 👎
Re: How to copy file path with forward slash?
2bebbeb wrote: 2026-02-14, 21:02 UTCA simple TotalCommander/Windows-native (PowerShell-based) solution, no third-party tools required:
Thank you very much for sharing
For the user command, it doesn't work at the beginning, I'm new to TC so I asked Copilot to provide an alternative and it works:
Code: Select all
User command name: em_toForwardSlash
Command: powershell.exe
Parameters: -NoProfile -Command "(Get-Clipboard -Raw).Replace('\','/') | Set-Clipboard"
Start path: leave empty
Icon file: optional
Tooltip: using forward slash path delimiters/Re: How to copy file path with forward slash?
2Stella75
My pleasure.
Glad it was helpful.
My original command used pwsh[.exe].
As soon as you changed "pwsh" to "powershell.exe" with the LLM's help, the command agreed to work in your current machine environment.
I apologise that I was too lazy to mention it in my first message at once.
Postscript
For your and other users information, that may come in handy in the future:
They are both PowerShell; however, there's a nuance.
The visual difference:
My pleasure.
Glad it was helpful.
powershell.exe is the key here on why the command didn't work for you at first.Stella75 wrote: 2026-06-10, 09:40 UTC For the user command, it doesn't work at the beginning, I'm new to TC so I asked Copilot...Code: Select all
User command name: em_toForwardSlash Command: powershell.exe ...
My original command used pwsh[.exe].
As soon as you changed "pwsh" to "powershell.exe" with the LLM's help, the command agreed to work in your current machine environment.
I apologise that I was too lazy to mention it in my first message at once.
Postscript
For your and other users information, that may come in handy in the future:
They are both PowerShell; however, there's a nuance.
The visual difference:
- Using powershell[.exe] executable implies we are running Windows PowerShell.
- Using pwsh[.exe] executable implies we are running Cross-Platform PowerShell.
- powershell.exe launches the legacy, Windows-only Windows PowerShell
Windows PowerShell (version 5.1 and older)
Development is frozen; slower startup, higher resource usage; underlying engine .NET Framework - pwsh.exe launches the modern, open-source, cross-platform PowerShell
Cross-platform PowerShell (version 6.0 and newer, 7+, currently 7.6.2)
Active development; faster startup, better performance; underlying engine .NET (Core)
https://github.com/PowerShell/PowerShell
https://github.com/PowerShell/PowerShell/releases
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Try the new cross-platform PowerShell ****//aka.ms/pscore6
C:\Users\YourUserName>
- Installing Cross-Platform PowerShell (7+) does not replace Windows PowerShell (5.1 and older).
By design, the new version has been made so both could happily coexist on the same system, side by side.
If your machine is running under Windows 10 or Windows 11, there are no reasonable grounds not to update PowerShell.
#278521 User License
Total Commander [always the latest version, including beta] x86/x64 on Win10 x64/Windows 11/Android 17
Total Commander [always the latest version, including beta] x86/x64 on Win10 x64/Windows 11/Android 17
Re: How to copy file path with forward slash?
2visrvisr wrote: 2026-02-15, 11:14 UTC I'd probably add "pwsh -NoProfile", since, depending on the profile, it can add a lot of latency.Code: Select all
❯ hyperfine 'pwsh -c 1' Time (mean ± σ): 3.871 s ± 0.810 s [User: 2.977 s, System: 1.201 s] ... 10 runs ❯ hyperfine 'pwsh -NoProfile -c 1' Time (mean ± σ): 331.8 ms ± 18.2 ms [User: 256.2 ms, System: 157.8 ms] ... 10 runs ...
Thank you again for your input.
I somehow missed, overlooked, and in other ways didn't pay due attention to the essence of this comment.
I need to dive deeper into that.
#278521 User License
Total Commander [always the latest version, including beta] x86/x64 on Win10 x64/Windows 11/Android 17
Total Commander [always the latest version, including beta] x86/x64 on Win10 x64/Windows 11/Android 17
Re: How to copy file path with forward slash?
2visr
Thank you one more time!
It turns out, in case of my 14-year-old Win 10 laptop, -NoProfile does not make a difference, which means my "PowerShell profile is exceptionally clean and well-optimized" 
Meanwhile, pwsh.exe runs twice as fast as powershell.exe (let alone it should run the actual commands faster as well); that's good to know.
I'm going to repeat that on other PCs.
Thank you one more time!
pwsh vs powershell with and without -NoProfile performance test using hyperfine
Test:
pwsh_powershell_NoProfile_performance_hyperfine.ps1
Results:
pwsh_powershell_NoProfile_performance_hyperfine.ps1
Code: Select all
$time = [diagnostics.stopwatch]::StartNew()
$env:Path += ";$pwd\bin"
hyperfine.exe -w 3 "powershell.exe -command 'exit'" "powershell.exe -NoProfile -command 'exit'" "pwsh.exe -command 'exit'" "pwsh.exe -NoProfile -command 'exit'"
''
# finalizing
$time.Stop()
'{0:mm\:ss\.fff} by {1}' -f $time.Elapsed,$MyInvocation.MyCommand.Name
sleep -seconds 55Code: Select all
Benchmark 1: powershell.exe -command 'exit'
Time (mean ± σ): 804.4 ms ± 12.0 ms [User: 1492.2 ms, System: 240.0 ms]
Range (min … max): 786.0 ms … 819.4 ms 10 runs
Benchmark 2: powershell.exe -NoProfile -command 'exit'
Time (mean ± σ): 806.9 ms ± 11.3 ms [User: 1470.3 ms, System: 283.8 ms]
Range (min … max): 784.7 ms … 822.5 ms 10 runs
Benchmark 3: pwsh.exe -command 'exit'
Time (mean ± σ): 403.5 ms ± 4.6 ms [User: 445.3 ms, System: 196.2 ms]
Range (min … max): 393.3 ms … 409.2 ms 10 runs
Benchmark 4: pwsh.exe -NoProfile -command 'exit'
Time (mean ± σ): 419.0 ms ± 15.7 ms [User: 475.0 ms, System: 186.9 ms]
Range (min … max): 396.3 ms … 445.5 ms 10 runs
Summary
pwsh.exe -command 'exit' ran
1.04 ± 0.04 times faster than pwsh.exe -NoProfile -command 'exit'
1.99 ± 0.04 times faster than powershell.exe -command 'exit'
2.00 ± 0.04 times faster than powershell.exe -NoProfile -command 'exit'
00:33.381 by pwsh_powershell_NoProfile_performance_hyperfine.ps1Meanwhile, pwsh.exe runs twice as fast as powershell.exe (let alone it should run the actual commands faster as well); that's good to know.
I'm going to repeat that on other PCs.
#278521 User License
Total Commander [always the latest version, including beta] x86/x64 on Win10 x64/Windows 11/Android 17
Total Commander [always the latest version, including beta] x86/x64 on Win10 x64/Windows 11/Android 17
Re: How to copy file path with forward slash?
Which ones exactly? The link to lst2clip-u.exe that I gave you, doesn't it work for you? It was the fastest and most optimal solution of all those suggested, especially compared to the slow first-run powershell, which requires a console and has version and OS limitations. lst2clip-u will work for you quickly, without flickering and without any hassle, even on XP.
Overquoting is evil! 👎
Re: How to copy file path with forward slash?
2bebbeb wrote: 2026-06-10, 11:44 UTC
For your and other users information, that may come in handy in the future:
They are both PowerShell; however, there's a nuance.
Thank you very much for such detailed explanation. I've downloaded the pwsh and now your command works for me and it's actually quicker than powershell exe.
Re: How to copy file path with forward slash?
2Fla$herFla$her wrote: 2026-06-10, 14:21 UTCWhich ones exactly? The link to lst2clip-u.exe that I gave you, doesn't it work for you? It was the fastest and most optimal solution of all those suggested, especially compared to the slow first-run powershell, which requires a console and has version and OS limitations. lst2clip-u will work for you quickly, without flickering and without any hassle, even on XP.
The add-in was my first attempt since there are several posts recommemded this tool. But unfortunately I'm using a company workstation so that all the links are block for me. Or maybe because the location I'm in
Re: How to copy file path with forward slash?
2Stella75
1. Don't have access to mediafire.com? Or is there a problem with downloading archives?
2. Does this button code not work for you?
1. Don't have access to mediafire.com? Or is there a problem with downloading archives?
2. Does this button code not work for you?
Overquoting is evil! 👎


