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.

This question already has an answer here:

I need to do a Bat file (or something like that) that do a Incremental Backup of some especified folders when, and just when, the Ethernet Cable is connected.

How can I do it? I have no idea how can I start..

share|improve this question

marked as duplicate by Julian Knight, Tog, Nifle, Dave, David Jan 21 at 1:49

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2 Answers 2

up vote 0 down vote accepted

You need to create a Windows scheduler task that fires based on an event in the Event Log.

This previous answer will help: How to launch a command on network connection/disconnection?

You will probably need to add a delay as it takes quite a time for Windows to fully start the network and assign drives, etc.

Note that this assumes you are using Vista or above.

Do actually do the backup, try looking up the help for the Robocopy or xcopy commands.

share|improve this answer

This PowerShell code will show you all installed adapters, and their connection status.

Get-WmiObject -Class Win32_NetworkAdapter | Format-Table -Property Name, NetConnectionStatus -AutoSize

Status of 2 means connected. There are more details and in-depth examples on the Hey, Scripting Guy! site.

This article gives you more options, if PowerShell is not your thing - you could do something similar with netsh.

share|improve this answer

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