Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

how can i run schtasks from command line such that i can pass in parameters during run time. i have a batch job which expects parameters during run-time that is created in scheduled task. i cannot have a fixed parameter so i cannot provider the parameter when i first create the task i need to provide this during the run time. i was hoping if there is a way to do like, i need to run this task from schtasks using command line, because i can set the task to run as Admin and give user with less role invoke the task on demand

schtasks /Run /Tn "task" /parameter....?

share|improve this question

Another solution could be to have your powershell script print out the parameters or data that your batch job needs to a text-file, and then have the batch job read from the text file at run time.

I'd take Shane Madden's comment into account though, whoever has access to writing to this text file and executing the scheduled task, has access to a modify the behavior of the process

share|improve this answer

Here is an example of parameter passing with schtasks:

schtasks /create /tn "test" /TR "\"C:\Program Files\SyncToy 2.1\SyncToyCmd.exe\"-R" /sc daily /st 08:00:00
share|improve this answer

No - parameters are configured within the task itself.

I'd hesitate to think that this would be workable from a security perspective, either - hypothetically, someone with a task running cmd.exe with a certain set of parameters, having those parameters modified at execution by a non-admin user? Not a good situation.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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