Hi
How to make a list of files %UF with quotes in TC?
ex
"Text.txt"
"Folder\"
Please help
Help: How to make a list of files %UF with quotes in TC?
Moderators: Hacker, petermad, Stefan2, white
Re: Help: How to make a list of files %UF with quotes in TC?
PiotrMPPL wrote: 2023-07-14, 07:09 UTC Hi
How to make a list of files %UF with quotes in TC?
ex
"Text.txt"
"Folder\"
Please help
One way for example:
(copy&paste button code)
Code: Select all
TOTALCMD#BAR#DATA
powershell -noexit
Get-Content '%UF' | ForEach{ ""[char]34""+$_+""[char]34"" } | Out-File "$env:Commander_Path\_FileList.txt"
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
PS TEST ForEach in "%UF" (selected files and folders)
-1
Explanation
- TC create a temp file with all selected files and folders (%L, %F, %Wx , %Ux)
----- right click an button to edit it, in that dialog press the [Help]-button for more...
- We read that temp file (Get-Content '%UF') and loop over it (ForEach-Object{ $_})
- For each line from that temp file ($_) we get the line and add quotes around
---- tricky " " [char]34 " " because TC eats the outer quotes and so does the posh interpreter
---- normally we use three quotes " " " or \" to get one single quote, but here we want also to get an quote in the output

- The result we put out to a new file in the TC folder or to clipboard if you want:
Out-File "$env:Commander_Path\_FileList.txt"
Out-File "$env:TEMP\_FileList2.txt"
Out-File "C:\TEMP\_FileList3.txt"
Set-Clipboard (needs PSv5 or newer)
Re: Help: How to make a list of files %UF with quotes in TC?
2PiotrMPPL
Do you need a list in a file or clipboard?
Do you need a list in a file or clipboard?
Overquoting is evil! 👎