Asim Imam
Asim Imam

Reputation: 373

Create a task with task Scheduler to run cmd.exe with commands

I created a task with the task scheduler in windows 10 to open cmd.exe. it ran successfully like this

The output successfully achieved

But I need to run some commands every time it opens something like this

enter image description here

and automatically runs this command.

this is important that it opens a command prompt first and then runs the command inside the command prompt automatically.

Upvotes: 1

Views: 33003

Answers (1)

OwnageIsMagic
OwnageIsMagic

Reputation: 2299

Use /k flag. See cmd.exe /k switch.

If you don't need console window to stay after commands completed use /c flag. You can read more about them with cmd /?

Upvotes: 3

Related Questions