Author Topic: How to execute a command on multiple selected files?  (Read 10228 times)

ajax

  • Junior Member
  • **
  • Posts: 25
    • View Profile
How to execute a command on multiple selected files?
« on: October 09, 2021, 22:31:05 »
I'd like to be able to select multiple files and then execute a command on all of them.  For example, suppose I want to set the read only attribute on all of the files in a particular folder.

I've tried using the "User Defined Commands" feature to create an external command.  For my example I tried the following:

attrib +R ${focusfilepath}

This seems to work but only on a single file no matter how many have been selected.

Is it possible that doing this requires the use of a multi-script command rather than external command?  I have been able to process multiple files with such a command but writing such a command seems like quite a lot of bother for something as simple as this example.

This seems like a very normal thing to want to do and one could imagine a lot of different examples where all we want is to execute a single Windows command on a batch of files.  Hope there is a simple way to do it!

AlanJB

  • VIP Member
  • *****
  • Posts: 436
  • VERY old Programmer
    • View Profile
Re: How to execute a command on multiple selected files?
« Reply #1 on: October 10, 2021, 12:18:56 »
You will need MultiScript for this, using the function GetSelectedPaths().