Restart App From Mac Command Line

This prints out a summary of the command-line options.-nonaming. This disables the use of JNDI within Tomcat.-security. This enables the use of the catalina.policy file. This starts Tomcat in debugging mode. This allows Tomcat to be tested in an embedded mode, and is usually used by application server developers. But for older versions of Mac OS X, and because app bundles aren't designed to be passed command line arguments, the conventional mechanism is to use Apple Events for files like here for Cocoa apps or here for Carbon apps. You could also probably do something kludgey by passing parameters in using environment variables.

Learning has never been so easy!

-task bar disappeared?
-Screen resolution is off and can't see your task bar ?
-RDP (Remote Desktop Protocol) and no restart/shutdown options ?
- just bored of doing the routine restart (start menu-->shutdown ->restart)?
-or maybe you just want to look cool around people ;-}?
or just for fun and want to prank others?
so how to restart using the Dos command or CMD?

How To Restart From Command Prompt

3 Steps total

Step 1: Open CMD

to open CMD :
1. on your keyboard: hold windows logo key down and press 'R'
this will open Run
2. type: CMD and hit enter
this will open the Dos Command

Terminal Command To Restart Mac

you can open CMD in many ways but I prefer this way in case your screen resolution is off and you like to see what you're doing.

Step 2: Command Line to restart

to restart type the following (noting the spaces):
shutdown /r /t 0

NOTE: there's a 1 space before each forward slash '/' and 1 space before x seconds (between t & # of seconds you specify).

Explanation:
/r to request restart
/t 0 sets the time to 0 seconds until it restarts.
you can choose from /t 0 for zero seconds up to /t 1,440,000 (400 hours) [corrected]
Examples:
shutdown /r /t 60 =1 minute until the system restarts
shutdown /r /t 180 = 3 minutes until the system restarts

Step 3: Good to know: Command Line to shutdown

Mac Run App From Terminal

to Shutdown, type the following (noting the spaces):
shutdown /s /t 0

Restart App From Mac Command Line Download

NOTE: there's a 1 space before each forward slash '/' and 1 space before x seconds (between t & # of seconds you specify).

Explanation:
/s to request shutdown
/t 0 sets the time to 0 seconds until it restarts.
you can choose from /t 0 for zero seconds up to /t 1,440,000 (400 hours) [corrected]
Examples:
shutdown /s /t 60 =1 minute until the system shuts down
shutdown /s /t 180 = 3 minutes until the system shuts down

Published: Dec 06, 2017 ยท Last Updated: Dec 08, 2017
Mac run app from terminal

32 Comments

  • Tabasco
    Cerbere Dec 6, 2017 at 08:57pm

    Good write-up, but you left out my most common scenario for using this on the command line: When I'm RDP'd into a machine, and the restart (and shut down) option(s) aren't available through the start menu.

  • Anaheim
    CYBW1Z Dec 6, 2017 at 09:01pm

    @Cebere very true. I actually bumped into that issue few weeks ago.... I'll add it thanks!

  • Thai Pepper
    Frostyck Dec 6, 2017 at 09:22pm

    Plus if you want to be even faster, just press the start button and type CMD.

    No need to go through the run command.
    Shaves off the super massive time of one single keystroke lol.

  • Cayenne
    randallader Dec 6, 2017 at 09:59pm

    I created a Restart.bat file for the users of some VM's that RDP into for the express purpose of restarting/shutdown/cancel of said VM's without waiting for me. Been doing this for years.

    Useful and easy for them.

    Here's my code:
    REM Restart/Shutdown/Cancel batch file for times where you may not have access to those options on the start menu
    REM Remove the rem statements on the :Restart, :Shutdown and :Cancel subroutines for this to work

    cls
    @ echo off

    choice /s RSC /n /t 30 /d c /m '[R]estart in 30 sec, [S]hutdown in 30 sec or [C]ancel?'

    if errorlevel 1 if not errorlevel 2 goto Restart
    if errorlevel 2 if not errorlevel 3 goto Shutdown
    if errorlevel 3 goto Cancel

    :Restart
    rem shutdown /r /t 30
    echo Restarting in 30 seconds...
    echo Rerun batch file to abort restart.
    goto End

    :Shutdown
    rem shutdown /s /t 30
    echo Shutdown commencing in 30 seconds...
    echo Rerun batch file to abort shutdown.
    goto End

    :Cancel
    rem shutdown /a
    echo Aborting restart/shutdown.

    :End

  • Habanero
    Gorfmaster1 Dec 6, 2017 at 10:57pm

    On my friend's computer, Here is how I got to wean him off of using Internet Explorer. I created a batch file that had that shutdown command and changed the icon to IE. So every time he clicked on the Internet Explorer Icon, it turned off his computer. Made it more secure too.

  • Jalapeno
    ferrit2uk Dec 7, 2017 at 01:07pm

    Shutdown -i to restart someone elses computer if you're domain admin or have the rights that is and know the PC name or IP of who to shut down/reboot

  • Cayenne
    jayson1775 Dec 7, 2017 at 07:15pm

    Powershell much much gooder.

    powershell in run

    rest tab , that will display restart-computer, hit enter.

  • Cayenne
    Greg2078 Dec 7, 2017 at 07:28pm

    There's an 'Uh Oh' article somewhere by me...please don't use -t 0
    Give yourself a little time, so when you realize you accidentally ran that on the wrong console, you have some time to shutdown -a

    (-a is for abort)

  • Tabasco
    LanceHarmstrong Dec 7, 2017 at 07:31pm

    This is quite basic, but I'll bite.

    Why are you running command prompt from win+r or start menu? Both of those things will accept shutdown commands directly. In fact, you can run a shutdown command from any explorer window, as well.

    Win key - type shutdown . Done.

  • Cayenne
    davecork Dec 7, 2017 at 07:57pm

    Another little tidbit... I have this set up in task scheduler. If I want to schedule a reboot, I just change the trigger (time). This allows me to reboot in the middle of the night, while I'm soundly sleeping.

  • Jalapeno
    RedW1dow Dec 7, 2017 at 08:34pm

    you can also add a comment to a popup with -c '. I used to create a shortcut with this command in HS and make it look like IE.

    shutdown -s -t 120 -c 'All files will be deleted upon shutdown!'

    It was all for fun and games.

    ALSO, use shutdown -a to abort the scheduled shutdown!

  • Serrano
    Lendys Dec 7, 2017 at 08:38pm

    Also, to log out of the local machine:
    shutdown /l
    (that's a lowercase L)

    Also also, the /i parameter VeriLan mentioned does shutdown/restart a remote machine, but it pulls up a GUI. If you wanna stay strictly command line, add:
    /m %hostname%
    Unfortunately, that doesn't work with the logoff parameter...

  • Tabasco
    dwren Dec 7, 2017 at 09:13pm

    Good, but in step 3 you copied and pasted the restart commands. Your /r should be /s in those last two lines.

  • Serrano
    Sean4178 Dec 7, 2017 at 09:20pm

    /f at the end will force it if there are applications or OS hangs

  • Thai Pepper
    MR.Burnz Dec 7, 2017 at 09:25pm

    Very cool. I don't really run into the scenario to use this but I will try this. Thank you.

Mac terminal commands
  • prev
  • 1
  • 2
  • 3
  • next