How to run my 'Touch Script' on all selected files?

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
Reenen
Junior Member
Junior Member
Posts: 2
Joined: 2016-12-12, 21:31 UTC

How to run my 'Touch Script' on all selected files?

Post by *Reenen »

I want to run my touch script for all files selected in Total Commander.

This is the command that "touches" a file in windows, but I want this to run for every file I selected.
C:\> powershell (ls your-file-name-here).LastWriteTime = Get-Date
Could someone give me a pointer for how I can create a touch "button" in my TC?

Thanks!
Reenen
Junior Member
Junior Member
Posts: 2
Joined: 2016-12-12, 21:31 UTC

Post by *Reenen »

Nevermind google found this: /board/viewtopic.php?t=14504 old post.

(I'm not yet able to post links)





Mod:
http://www.ghisler.ch/board/viewtopic.php?t=14504
I needed a touch utility that would work on multiple selected files
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Anyway, you can pass list of selected files/folders to a program using %WL button argument (this will be expanded to path to a temporary Unicode filelist). Unfortunately there is no safe way of passing paths to PowerShell command line scripts (paths may contain special characters that may be interpreted by PowerShell itself), only to script files:

Code: Select all

Command: powershell.exe
Parameters: -ExecutionPolicy Bypass -File X:\Path\TouchAll.ps1 "%WL"
And TouchAll.ps1 may look like this:

Code: Select all

Get-Content $args | % { Write-Host $_; (Get-Item -Force $_).LastWriteTime = Get-Date; };
Post Reply