Powershell Script to Create a New Folder Directory

Greetings all!

Been using Listary for a long time, but just really started digging into some of the more advanced uses for custom commands and actions recently. I’m trying to get a Powershell script to play nice in Listary, but I must be missing something. When I run this script inside Powershell (in whatever directory I’m wanting to perform the folder structure creation) it runs just fine and does exactly what I want - it creates a parent folder with the three sub-folders inside:

“New Project Folder\Originals”,“New Project Folder\Working”,“New Project Folder\Final” | %{New-Item -Name “$_” -ItemType “Directory”}

However, when I try to run the same thing as a custom command in Listary with that line of code in the Parameters field (with -noexit prepended so I can see the error message to try to see why it’s failing) it fails to do anything at all. I’m using powershell.exe in the Path field.

Hopefully, somebody might have some insight into how I need to modify this script to run correctly from Listary. It seems that either Listary is passing/not passing something correctly into Powershell that I can’t see, or I’m missing some piece of native Listary coding/parameters to make this one run correctly.


Listary is starting your Powershell in System32 in not in the dir you think.
Even setting the Working Directory to the search result doesn’t help.
Solution is to add the parameter {action_path} to your action
and let PowerShell change the working dir to this parameter before doing the rest.

1 Like

Thanks horst! I noticed that yesterday too, and have been working on modifying this to include that parameter. I haven’t quite figured out the correct syntax yet, but hopefully I’ll be there soon!