10-04-2025, 04:31 AM
This function is not nice nor does it care:
Code: (Select All)
Color 15
Print "Enter (R)eboot/(S)hutdown";
Input x$: x$ = UCase$(x$)
If x$ = "R" Then
$If WIN Then
x$ = "%windir%\System32\shutdown.exe /r /t 0"
Call ShellSub(x$)
Print "Reboot failed.."
End
$End If
$If LINUX OR MAC Then
x$ = "/sbin/shutdown -r now"
Call ShellSub(x$)
Print "Reboot failed.."
End
$End If
Print "OS not supported.."
End
End If
If x$ = "S" Then
$If WIN Then
x$ = "%windir%\System32\shutdown.exe /s /t 0"
Call ShellSub(x$)
Print "Shutdown failed.."
End
$End If
$If LINUX OR MAC Then
x$ = "/sbin/shutdown -h now"
Call ShellSub(x$)
Print "Shutdown failed.."
End
$End If
Print "OS not supported.."
End
End If
End
' subroutine to shell to dos
Sub ShellSub (x$)
BatchFile$ = "EXTERNAL.BAT"
X = FreeFile
Open BatchFile$ For Output As #X
Print #X, "@ECHO OFF"
Print #X, x$
Print #X, "PAUSE"
Print #X, "EXIT"
Close #X
Shell BatchFile$
End Sub
