...
Code Block |
---|
$Dir = ..... $Ext = ..... $a = "List $Dir with Extension $Ext `n" + "=========================="; $a # Filenames as a list GCI $Dir -R | Where \{$_.Extension -EQ $Ext\} | sort-Object -descending Length | Format-List -property * |
using command line parameters
Code Block |
---|
powershell ... -file "%SCHEDULER_PARAM_SCRIPT_FILENAME%" "%SCHEDULER_PARAM_FolderName%" "%SCHEDULER_PARAM_FileNameExtension%"
|
Code Block |
---|
$Dir = $args[0]
$Ext = $args[1]
.
...
|
Depending on the parameters the job has to be different. No general solution for a generic powershell job is possible.
using environment variables
The command line, which is used to start the script, has no parameters for the script:
Code Block |
---|
powershell ... -file "%SCHEDULER_PARAM_SCRIPT_FILENAME%"
|
The scripts gets the values for the parameters by reading the environment variable for each parameter (see Passing Parameters to shell-jobs):
Code Block |
---|
$Dir = $env:SCHEDULER_PARAM_FolderName $Ext = $env:SCHEDULER_PARAM_FileNameExtension . ... |
...