Schtasks, only start the task when the computer is connected to the network?

417 Views Asked by At

I want to perform a scheduled task regardless of whether it is AC power or battery power. How can I achieve this via schtasks via parameters?

1

There are 1 best solutions below

0
On

You can't: schtasks does not provide any parameters, you can use for checking where the power is coming from.

So, you need to launch the command either way, but inside that command, you can check for this, let me show you this example that you can use in case your command is a batchfile:

WMIC Path Win32_Battery Get BatteryStatus

This example is described in this other Stackoverflow post.