Thread: restart computer?

  1. #1
    Programmer Frantic-'s Avatar
    Join Date
    Dec 2004
    Posts
    114

    restart computer?

    how can i make a dos application restart the user computer?

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    Code:
    system("shutdown -s -f -t 0");
    My best code is written with the delete key.

  3. #3
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    judging from the information you gave us, try using
    Code:
    system("reboot -q");
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  4. #4
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    or
    Code:
    system("warm")
    system is a function included in cstdlib that simply executes the OS command given to it as a string parameter. It's usage is often advised against for a number of reasons, but considering you have specified that this is a DOS program, most of those concerns go away. Just be aware that if there is another way to do something, system should generally be avoided. In this case, feel free.

    ... and you're probably curious as to what those reasons are. Basically they're two fold:

    1) Unexpected bahavior if the program has been moved, replaced, deleted, etc...
    2) OS - dependant (this concern does not matter in this case)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. some odd computer problems
    By DavidP in forum Tech Board
    Replies: 14
    Last Post: 03-31-2008, 06:25 AM
  2. Replies: 34
    Last Post: 02-26-2006, 01:16 PM
  3. Major Computer Problem
    By Olidivera in forum Tech Board
    Replies: 10
    Last Post: 07-15-2005, 11:15 AM
  4. Tabbed Windows with MDI?
    By willc0de4food in forum Windows Programming
    Replies: 25
    Last Post: 05-19-2005, 10:58 PM
  5. Computer will not boot.
    By RealityFusion in forum Tech Board
    Replies: 25
    Last Post: 09-10-2004, 04:05 PM