When running a command either manually or through an automation process or script, a permission denied error message is returned.
Windows
Your command is being executed where the current working directory is a location where you do not have permission to create new files. The current working directory is used to produce TMP files during the encryption process regardless of original file or output file locations.
Change the directory of your current working directory. You can add a command at the beginning of your script to change the directory, or run the script from an alternate location.
In the example, our current working directory was C:\Windows, a location typically disallowed from creating new files without elevated privilege. After adding a change directory command to the script to an allowed location, the output was successful: