Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to schedule a task through cmd, the task has to run a .bat file when my WiFi connects. I have manually created a task which does this but I want to do this by command line.
I tried this command line, which i made up by copying lines out of the XML file when i exported to manually created task, to be sure that it is correct.
But it gave an error that i cant use the AND operator. This is the command line:

schtasks /CREATE /TN "HotspotTest" /TR C:\BatchScripts\test.bat /SC ONEVENT /EC System /MO *[System[Provider[@Name='Microsoft-Windows-NetworkProfile'] and EventID=10000]]

Maybe the channel is wrong but i don't know which one to use else. It could be that i have to add a source but i don't have an idea how to do this properly. Could anyone help me with this?

share|improve this question

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.