batch file - Select power cable unplug event windows8 -
i create .bat file has following qualities:
detect power cable unplug
detect power cable re-plug/reinserted
start when windows starts
detect shutdown and/or power button push (turn off)
play sound on repeat until correct password provided
if [x]/exit pressed while waiting correct password reopen, continue sound , ask password.
if user whant exit bat ask pass , play sound on repeat.
basically want create simple anti theft script
when power cable in un-plugged/plugged power usage/option icon on task bar changes eather power=100%/power=7-100%/power=(charging)7-99%
the unplug/re-plug event windows recognizes. think hardest part tried google , going on usbs , criptocurrencies.
update: has
c:\windows\system32\svchost.exe -k dcomlaunch if 1 has info on of 7 things want achieve feel free reply.... in mean tim have found few bat websites , updating question as-and-when discover put examples each parts under here...
------------------------------------------- anti theft bat tutorial:
- create new txt file right click , rename > [secure_name].[bat]
to find out whether or not power adapter plugged in try using wmic. can use wmic computersystem list list available options - think powerstate might want wmic computersystem powerstate. try checking these values while cable plugged in, , while not. looking whatever differs.
the way can think stop system shutting down running shutdown /a. i'm not sure can detect if system shutting down, abort shutdowns in progress. if system not shutting down when run command, tells that. abort shutdown if button pressed, not if button held, cannot stopped (or detected using batch).
as playing sound, can use alt + 7 output beep. in batch file, @ command prompt type echo press ctrl + 7 followed >>batchfile.bat. replacing batchfile.bat name of batch file. append 'beep character' end of batch file. there can copy , paste want. command prompt:
echo •>>batchfile.bat
the • character different in notepad (presumably in text editors). might idea make sure volume set 100%. can download , use nircmd - command nircmd.exe setsysvolume 65535 set volume max.
to stop user closing batch file readily, can use simple vbscript call batch script no window associated it, run in background. see: https://serverfault.com/questions/9038/run-a-bat-file-in-a-scheduled-task-without-a-window
for getting password, take @ answer question here - can mask input text in bat file. spawn window take password.
these ideas of how might achieve idea of yours - i'll leave other technicalities of implementation you. feel free ask more questions run problems writing script.
Comments
Post a Comment