| Forum Home | ||||
| Press F1 | ||||
| Thread ID: 95540 | 2008-12-09 22:13:00 | Batch file help | nofam (9009) | Press F1 |
| Post ID | Timestamp | Content | User | ||
| 727279 | 2008-12-09 22:13:00 | I'm trying to figure out how to write a batch file that performs an action once a reply is received from a ping. The scenario is this: 2 laptops that connect wirelessly back to a server. The server's MoBo supports Wake on LAN, so I want a batch file that only sends the magic packet to the server's NIC once it senses that the laptops' wireless has connected. This turns on the server whenever either of the lappies connects, ensuring my files are available. I'm currently using the following: @echo off ping -n 18 localhost WOL.EXE [MAC address of servers' NIC here] This does work, but it's a little clunky because it's just pinging itself for 18 seconds (effectively just a pause to fair for the wireless to connect) before calling the program. Hope this makes sense! :thumbs: |
nofam (9009) | ||
| 727280 | 2008-12-09 22:23:00 | Does this wol.exe command say it works with wireless?? Somehow I think it may only work with ethernet How would WOL (this I would say, is usually for ethernet, not wireless), know you have wireless? |
Speedy Gonzales (78) | ||
| 727281 | 2008-12-09 22:33:00 | LOL yeah you're right speedy :p But it DOES work once the wireless connects - I've been using it with the batch file above for a few days now . . . . I just want a more elegant solution . |
nofam (9009) | ||
| 727282 | 2008-12-09 22:40:00 | Well if all 3 were connected with ethernet, and all 3 had options like WOL in the BIOS. That would probably be the easiest way. Once you turn one on, the other 2 will come on Since they'll detect the LAN signal from each other |
Speedy Gonzales (78) | ||
| 727283 | 2008-12-09 23:07:00 | That's what I'll do once I build my HTPC which will be hard-wired via Gigabit ethernet to the media server. The batch file solution will do for now with the laptops. |
nofam (9009) | ||
| 727284 | 2008-12-09 23:13:00 | The server doesnt have wireless as well does it? It would probably have to be onboard. If it did you could try bridging it and the LAN? Isnt that what bridging does? |
Speedy Gonzales (78) | ||
| 727285 | 2008-12-09 23:50:00 | you might be able to modify this example www.codingforums.com |
beama (111) | ||
| 727286 | 2008-12-10 00:03:00 | You might want to check out what M$ has to say about the subject at MSDN (msdn.microsoft.com(VS.85).aspx). There's got to be some useful info you can get via the WMI interface... You can start a Windows script via cscript or wscript (GUI) at the command line. |
MushHead (10626) | ||
| 727287 | 2008-12-10 00:05:00 | Maybe something like this: @echo off echo . ping -n 5 %1 if errorlevel 1 ( goto wake-on-lan ) echo . echo Machine %1 already awake . goto end :wake-on-lan echo . echo Sending WOL packet to %1 (%2) WOL . exe %2 goto end :end call it with: whatever-you-call-the-bat-file [machine-host-name] [mac-address] eg . test-ping . bat myserver e2-b1-c3-d4 |
dyewitness (9398) | ||
| 727288 | 2008-12-10 00:21:00 | is that copyrighted dyewitness (please say no :lol:) cause I can see a use for it already and yes I tested it. thank you |
beama (111) | ||
| 1 2 | |||||