Search code examples
windowspowershellscriptingpopupshutdown-script

Why is the message of the shutdown pop-up cut off?


I am working on a prank Program that randomly reboots your pc while also doing other stuff.
Anyways, I am currently working on the reboot part and I came up with this command:

shutdown -g -t 30 -d p:2:18 -c "Dieser Computer wurde von einer externen Quelle übernommen und wird momentan infiziert mit dem WannaCry Virus. Um nicht-autorisierten Zugriff auf anderen Computern in diesem Netzwerk zu vermeiden starten wir nun Ihr Gerät neu." -f

My Problem is that the text is being cut off because of no particular reason. This is what the pop-up looks like:

The Pop-Up

I did some research on why this could happen, but I see no reason.
/c "comment": This command option allows you to leave a comment describing the reason for the shutdown or restart. You must include quotes around the comment. The maximum length of the comment is 512 characters.

Source: https://www.lifewire.com/shutdown-command-2618100

Does anyone know why this could happen?

Thanks in advance

TRG


Solution

  • Interesting, I can reproduce using an even shorter message like "nicht-auto" or "n-a". Perhaps it interprets "-a" like a new parameter, despite being quoted. If you remove the dash "-", it works. Looks like a bug to me.

    A workaround is to replace the dash by an alternative Unicode character:

    shutdown -g -t 30 -d p:2:18 -c "nicht$([char]0x2010)autorisierten" -f