10-08-2025, 03:07 PM
(This post was last modified: 10-08-2025, 06:41 PM by SpriggsySpriggs.)
On Windows, I feel like you would just go to Task Scheduler and set up a reboot task there. I think something similar exists in Linux, too. "SYSTEM" might also be better than "END" for this, so your program will exit at the end rather than waiting for a keypress. Since this is running console commands, would make sense to make the program "$CONSOLE:ONLY" so it doesn't take up more space and runs faster. Also, "COMMAND$(n)" exists for parsing the command line without needing to use another declaration of the Win32 API. If you want to stay using GetCommandLineA, you don't need to use a 1,000-character string to store the result. You can do a declare library block for strlen and call it on GetCommandLineA and store the result in a LONG variable.
Then you could set your "ms" string variable to the size by using "SPACE$(n)". You would then use the sub version of "_MemGet". This allows you to use a variable length string with _Mem.
Here is a working test of what I proposed:
Then you could set your "ms" string variable to the size by using "SPACE$(n)". You would then use the sub version of "_MemGet". This allows you to use a variable length string with _Mem.
Here is a working test of what I proposed:
Code: (Select All)
Declare Library
Function strlen& (ByVal str As _Offset)
Function GetCommandLineA%& ()
End Declare
Dim As _MEM m
Dim As _Offset a
Dim As String ms
Dim As Long cmdLen: cmdLen = strlen(GetCommandLineA) 'using "test -r -b" as my command line switches for the test in the below screenshot
ms = Space$(cmdLen)
a = GetCommandLineA
m = _Mem(a, cmdLen)
_MemGet m, m.OFFSET, ms
_MemFree m
Print ms
The noticing will continue

