#1 2020-03-03 13:00

dmac
Member
Registered: 2020-03-03
Posts: 2

Powershell script to downloading files - set local directory location

Hi,
I have a powershell script that is downloading files locally from my server.
When I execute this script manually, it downloads these files to its current working directory. i.e. C:\autoscripts\xxx
When I schedule this script via Shutter, it is downloading the files to the program install directory: C:\Program Files (x86)\Shutter
Can I set this somewhere with Shutter?
Thank you.

Offline

#2 2020-03-03 19:09

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,161

Re: Powershell script to downloading files - set local directory location

Hi dmac, welcome.

I am guessing, executing something by Shutter, sets Shutters' dir to the CWD.
So I would adjust the PoSh script to add the path to the wanted download folder.




 


Read the  *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)

Offline

#3 2020-03-03 20:34

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,440

Re: Powershell script to downloading files - set local directory location

Instead of relying on the current directory being set correctly for your script, you should dynamically retrieve the script's directory and use it to define where your files will be downloaded. In this way you can execute your script with any current directory.

In the Command Prompt you can find out the script's directory via %~dp0 variable.

In the Power Shell there are several different ways available depending on the version, see here:
https://stackoverflow.com/questions/546 … ell-script

Processes that are executed by Shutter will automatically inherit Shutter's current working directory, that is the default behaviour in Windows.

An option for setting the working directory for the "Run Program" action will be available in the next version.

Offline

#4 2020-03-04 10:28

dmac
Member
Registered: 2020-03-03
Posts: 2

Re: Powershell script to downloading files - set local directory location

Thanks guys for the prompt responses.
I have fixed this by explicitly setting the output directory via the script. It was more a powershell script issue than a Shutter one.
Just found Shutter and really like it, will def upgrade to pro.
Thanks!

Offline

Board footer

Powered by FluxBB