# Action under Windows

**URL:** <https://kopia.discourse.group/t/action-under-windows/1633>\
**Category:** General Topics\
**Created:** [December 21, 2022, 3:48pm UTC](https://kopia.discourse.group/t/action-under-windows/1633 "2022-12-21T15:48:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ollibraun](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/ollibraun/32/551_2.png) [@ollibraun](https://kopia.discourse.group/u/ollibraun)\
**Post date:** [December 21, 2022, 3:48pm UTC](https://kopia.discourse.group/t/action-under-windows/1633/1 "2022-12-21T15:48:40Z")

</div>

Hello,

Here a script is not executed under Windows. The file D:\Kopia\after.ps1 exists.

`error running non-essential action command: exec: "C:\\Users\\OLIVER~1\\AppData\\Local\\Temp\\kopia-action2665930733\\powershell -WindowStyle Hidden D:\\Kopia\\after.ps1": file does not exist`

Could it be that something is not working in the script? It is the script for shadow copies under Windows:

> **[Actions](https://kopia.io/docs/advanced/actions/#examples)**
>
> Fast and Secure Open-Source Backup Software for Windows, Mac, and Linux

At “After folder” I have entered this:

> powershell -WindowStyle Hidden D:\Kopia\after.ps1

If I start CMD and go to any folder and then start powershell.exe, it always starts Powershell, so in PATH it should be the right one.

Best regards,  
Oliver

---

<div class="post-metadata">

**Author:** ![Jeremy\_Brown](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/jeremy_brown/32/573_2.png) [@Jeremy\_Brown](https://kopia.discourse.group/u/Jeremy_Brown)\
**Post date:** [January 8, 2023, 4:22am UTC](https://kopia.discourse.group/t/action-under-windows/1633/2 "2023-01-08T04:22:27Z")

</div>

I’m having the same issue, I even used the full path to powershell (C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe C:\path\to\script.ps1) and I’m still getting “file does not exist”. The error seems to be related to kopia, as pasting the above into cmd.exe works fine.

---

<div class="post-metadata">

**Author:** ![Jeremy\_Brown](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/jeremy_brown/32/573_2.png) [@Jeremy\_Brown](https://kopia.discourse.group/u/Jeremy_Brown)\
**Post date:** [January 8, 2023, 5:05am UTC](https://kopia.discourse.group/t/action-under-windows/1633/3 "2023-01-08T05:05:04Z")

</div>

Ok after some time I figured out that it is an issue with setting the command in KopiaUI. When using the CLI to set the actions as described in the docs ([Actions | Kopia](https://kopia.io/docs/advanced/actions/)) it works fine. The CLI splits the arguments, using the first one as the “command” and the subsequent ones as the “arguments”. But KopiaUI doesn’t do this, instead taking the whole string as the “command” despite there being no field for the arguments.

---

<div class="post-metadata">

**Author:** ![ollibraun](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/ollibraun/32/551_2.png) [@ollibraun](https://kopia.discourse.group/u/ollibraun)\
**Post date:** [January 8, 2023, 10:50am UTC](https://kopia.discourse.group/t/action-under-windows/1633/4 "2023-01-08T10:50:33Z")

</div>

Hm… I don’t really understand. Did you find a solution or does it not work with UI?

Thanks for your support!

---

<div class="post-metadata">

**Author:** ![chall4478](https://avatars.discourse-cdn.com/v4/letter/c/cab0a1/32.png) [@chall4478](https://kopia.discourse.group/u/chall4478)\
**Post date:** [January 9, 2023, 8:15pm UTC](https://kopia.discourse.group/t/action-under-windows/1633/5 "2023-01-09T20:15:11Z")

</div>

It doesn’t work correctly in the UI. If you click on the “Other” section in the Policy, you will see that “path” variable (in JSON) set to the full whole command you entered in the UI.

However if you use the following command and restart KopiaUI, you will see that JSON representation has the variable “path” set to “powershell” and “args” set to “C:\path\to\scripts\before.ps1”.

`"C:\Program Files\KopiaUI\resources\server\kopia" --config-file=<path to config file> policy set --before-folder-action "powershell C:\path\to\scripts\before.ps1" "<Policy Name>"`

---

<div class="post-metadata">

**Author:** ![6v8ys64c](https://avatars.discourse-cdn.com/v4/letter/6/b3f665/32.png) [@6v8ys64c](https://kopia.discourse.group/u/6v8ys64c)\
**Post date:** [April 4, 2023, 4:28am UTC](https://kopia.discourse.group/t/action-under-windows/1633/6 "2023-04-04T04:28:50Z")

</div>

Thank you for this, has anyone filed a bug for kopiaUI? This was very unexpected behavior.
