Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Reboot Your Computer
#1
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
Reply


Messages In This Thread
Reboot Your Computer - by eoredson - 10-04-2025, 04:31 AM
RE: Reboot Your Computer - by SierraKen - 10-04-2025, 10:25 PM
RE: Reboot Your Computer - by eoredson - 10-05-2025, 10:23 PM
RE: Reboot Your Computer - by SierraKen - 10-08-2025, 02:37 PM
RE: Reboot Your Computer - by SpriggsySpriggs - 10-08-2025, 03:07 PM
RE: Reboot Your Computer - by eoredson - 10-09-2025, 02:08 AM
RE: Reboot Your Computer - by SpriggsySpriggs - 10-09-2025, 11:38 AM
RE: Reboot Your Computer - by eoredson - 10-09-2025, 09:55 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Trust The Computer James D Jarvis 0 506 11-16-2023, 01:19 PM
Last Post: James D Jarvis
  Is your computer watching you? James D Jarvis 7 1,469 09-06-2022, 03:41 PM
Last Post: JRace

Forum Jump:


Users browsing this thread: 1 Guest(s)