Is there software for Windows where you could somehow add the following command, for example? Command: "if power: false then run shutdown" kp, but somehow stop so that my laptop gets the command to shut down when the power supply is disconnected.
No, how is that supposed to work?
If the PC has no more power, it can no longer work and thus of course nothing more.
There's a laptop. It probably has a battery
Oh yes, then something like that would work.
I said that I use a laptop and then of course it has a battery. Who can read has a clear advantage
Pretty much any programming language with sufficient authorization
Laptops usually have a battery.
Yes that works in all programming languages. E.g. In Python
if not power:
os.system ("shutdown / s / t 1")
Of course, you have to define the power value beforehand and make it available to the program.
I guess he means the battery is running
OP presumably means: If the power cord is disconnected, the laptop should be shut down.
Yes, I've been told by two others. But thanks
And how can I keep it running so that it always checks whether there's power / it is currently connected to the power supply?
You have to deal with Powershell a bit. On Stackoverflow someone asked the same question:
AutoIT could possibly also help.
With a while loop around it
while true:
if not power:
os.system ("shutdown / s / t 1")
But as I said, you first have to define what the Power parameter is and how this program should read this parameter.
In any case, this program would never stop and as soon as the parameter power is false it switches off the PC.
Oh god, i'm really not the expert in that sort of thing. Absolutely no idea how something like that works, haha
Well, check out some tutorials for Python or any other programming language. They are just there to automate things like that.
You should add a short pause in the loop. Otherwise, this short program could create quite a bit of processor load.
It certainly does, depending on how you query the true parameter, but the whole thing is just an example, the power parameter must also be defined and set.