Advertisement
Sajgoniarz

Remote computer restart

Jan 23rd, 2015
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <conio.h>
  4.  
  5. using namespace std;
  6.  
  7. void main()
  8. {
  9.     string remoteComp;
  10.     cout << "Remote shutdown by Samko\n\nLista komputerów w sieci :\n";
  11.     system("net view");
  12.     cout << "Podaj nazwę komputera który chcesz wyłączyć (bez \\\\) :\n";
  13.     cin >> remoteComp;
  14.     string prototype = "shutdown /r /t 10 /m \\\\" + remoteComp;
  15.     //system("cls");
  16.     cout << ("Czy na pewno zrestartować komputer? (y/n) :");
  17.  
  18.     if (_getch() == 'y'){
  19.         system(prototype.c_str());
  20.         cout << "Komenda wysłana!\n";
  21.     }else{
  22.         cout << "Komenda anulowana!";
  23.     }
  24.     system("Pause");
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement