How to Shutdown/turnoff a laptop by plugging out its charger?

JordanWhiteG

Solid State Member
Messages
19
Location
Australia
Hey guys,
I have also posted this question on another section because i didn't know which section to choose. so far this forum has been helpful for me so i thought i should post this question here.
So how can i shutdown a laptop by plugging out its charger?
I want a laptop to shutdown automatically as soon as its charger was plugged out.
if u know it, please tell me how and note that i need this method for a machine not personal use. thanks.
 
You could try Power Options in control panel.
Then click "Change Plan Settings" for your active plan.Then Select "Change Advanced Power Settings".
Scroll down to "battery" and expand it.
Expand "Low Battery Level" and change the "on battery" to a higher precent 95%

Then expand "Low batter action" and change "on battery" to shutdown...


Maybe that is what you are looking for?
 
thanks alot buddy i tried that before and it works but is there anyway to make an application for it?

and i don't want the laptop to turn on while the charger is plugged out.

I tried taking out the whole battery, but that's not safe and everytime it goes on safe mode and ETC.
 
Last edited by a moderator:
thanks alot buddy i tried that before and it works but is there anyway to make an application for it?

and i don't want the laptop to turn on while the charger is plugged out.

I tried taking out the whole battery, but that's not safe and everytime it goes on safe mode and ETC.

For making an application you could do it in several different languages.

Do you know any programming languages, or are you needing something written?

If you know C#, you can watch system events. You could also use AutoHotKey to detect if the system is on battery, and then shutdown. Those are just 2 languages I know could probably do it - I'm sure there's other libraries out there that have power state functionality (such as C++).
 
Last edited:
i'[m just having difficulties with writing the program :( i've never worked with C++ ! could you help me with that? i can do it in other languages and works perfectly but the thing is that the operating system we're using, won't support the program because it was written with an old language. If u could help me out with writing it on C++, that would be awesome or maybe give me some hints. thanks alot again for your time and your response.
 
Well what OS are you using? That's going to affect how you can do it, depending on the system libraries you can use.
 
Yep and i'm using an ipad!
But i might use a small PC for my work SO @SLacker your method is very good but when i plug out the charger it shutsdown and it works but when the charger is plugged out, and when i turn it on, it stays on and it doesn't shutdown.so i don't want my laptop to turn on while the charger is plugged out OR when i turn it on and the charger is plugged out, the pc would automaticlly shutdown.
Do you you know how to do this?
 
You never answered my question as to what Operating System you're running on the laptop.

And I already suggested how to possibly do it - make a service/script that detects when the Power State flag switches from AC (plugged in) to battery power. Then you can just invoke the shutdown command with like a 30 second timer in case you want to cancel it.

Some ideas here: Schedule a task when PC switches from charging to AC power [Windows]
Talks about PowerShell and C++.
 
Yep and i'm using an ipad!
But i might use a small PC for my work SO @SLacker your method is very good but when i plug out the charger it shutsdown and it works but when the charger is plugged out, and when i turn it on, it stays on and it doesn't shutdown.so i don't want my laptop to turn on while the charger is plugged out OR when i turn it on and the charger is plugged out, the pc would automaticlly shutdown.
Do you you know how to do this?

You can tweak the battery power controls and see if that gives you the control you desire.. I don't think it will. So that leaves you two options.
1.)Search for a software that will allow you this control.
or
2.) Take the advice of Carnage and write a script.

I am sure he will help ya out if you provide him some more info. Without answering what OS you are running the best answer to your question is.... write a script.
 
Back
Top Bottom