1

Are there any parameters defined for Task Scheduler arguments? Specifically, I'd like to send in the current location of the task.

For example: If I've got a task under Task Scheduler Library > My Application > Folder Name, I'd like to send Folder Name in as an argument to the action - something like %(CurrentLocation). Does Task Scheduler support anything like this?

0

You could wrap it in a PowerShell call and use .NET to get the machine name.

For "Program/script:" enter:

powershell

For "Add arguments (optional):" enter

/command "& { notepad $([System.Net.Dns]::GetHostEntry(\"\").HostName) }"

Replace <your_command> with the command you want to execute. The first argument to it will be the hostname.

  • So, I'm not looking for the machine name; I'm looking for the folder in which the task resides. I'll modify the question to be more clear. – zimdanen Jul 2 '18 at 21:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.