Here's a PowerShell script that can be run via Task Scheduler to set a WinSCP session's Local Startup Directory to reference the current year and month. It's equally easy to run this once a month or several times a day, using the Triggers settings in Task Scheduler.
$newPath="D:\outgoing & Incoming Files\xyz\xyz SETTLEMENT FILES\$(Get-Date -format "yyyy\\MMM")"
Set-ItemProperty -Path 'HKCU:\\Software\Martin Prikryl\WinSCP 2\Sessions\email@example.com\' -Name LocalDirectory -Type String -Value $regValue
You should Google for a recent guide to the full list of tokens allowed by the "format" parameter; some examples are at https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/get-date
, but beware: significant omissions from that list are "MMM" for the short Month Name and "ddd" for the short Day Name (for those that know them, "format" uses the list M$ popularized with VB and their other Scripting products.)
However, if you're more comfortable with the Unix date formatting tokens, use the "uFormat" parameter instead; see https://ss64.com/bash/date.html#format
for details on that list of tokens.
The code is broken up into several commands to enhance understanding and simplify maintenance, but it's technically possible to make this into a one-liner.
A good enhancement would be to move the Session Name into a variable, which would limit maintenance updates to the topmost portion of the script's code; this would also ease copying the script for use with another Session and Folder.