Batch File Trouble

Apr 24, 2011 at 1:18am
Could someone please tell me what is wrong with my code. First off this program is designed for you to type option 1,2,3, or 4 (which ever corresponds with the name of your computer), and once you have done this it will display a message and when you press any key a batch file will execute and close out all processes using a taskkill command in the batch file. However every time i compile this program i get 15 errors, and i dont know why so if someone would examine this code for me and try to compile it themselves and show me how it needs to be fixed to work properly.
thanks! and here it is:




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
// Proby's Second Program of Significance
#include <windows.h>
#include <Lmcons.h>
#include <iostream>
#include <fstream>
using namespace std;
int main ()
{
     string comm;
     system( "color B");
     cout<<("title Proby's Computer Fix 2");
     cout<<"Welcome to My Second Program!\n";
     cout<<"Type the Option for your Name From Below:\n";
     cout<<"-----------------------------------------\n";
     cout<<"Name:          Description:     \n";
     cout<<"--------      ------------------------\n";
     cout<<"option1       (Gerald Walker)\n";
     cout<<"option2       (Dakota Walker)\n";
     cout<<"option3       (Brenda Walker)\n";
     cout<<"option4       (Administrator)\n";
     system("pause>>nul");
      cout<<"";
     cout<<"";
     cin>>comm;
     if (comm == "option1")
     {
              // Pa Choice
              system("cls");
              cout<<"If you are Gerald Walker and wish\n";
              cout<<"to end all processes now, press enter.\n";
              cout<<"If you do not wish to do this please\n";
              cout<<"close the program now!\n";
              system("pause>>nul");
              system("geraldwalker.bat");
              system("pause>>nul");
              system("cls");
              }
     else if (comm == "option2")
     {
          // Dakota Choice
          system("cls");
          cout<<"If you are Dakota Walker and wish\n";
          cout<<"to end all processes now, press enter.\n";
          cout<<"If you do not wish to do this please\n";
          cout<<"close the program now!\n";
          system<<"pause>>nul");
          system<<("dakotawalker.bat");
          system<<"pause>>nul");
          system("cls");
          }
          else if (comm == "option3")
          {
               // Brenda Choice
               system("cls");
               cout<<"If you are Brenda Walker and wish\n";
               cout<<"to end all processes now, press enter.\n";
               cout<<"If you do not wish to do this please\n";
               cout<<"close the program now!\n";
               system<<"pause>>nul");
               system<<("brendawalker.bat");
               system<<"pause>>nul");
               system("cls");
               }
               else if (comm == "option4")
               {
               // Administrator Choice
               system("cls");
               cout<<"If you are: Administrator and wish\n";
               cout<<"to end all processes now, press enter.\n";
               cout<<"If you do not wish to do this please\n";
               cout<<"close the program now!\n";
               system<<"pause>>nul");
               system<<("administrator.bat");
               system<<"pause>>nul");
               system("cls");
               }
    else if (comm == "")
    {
    cout<<("");
    }
    else if (comm == "")
    {
    cout<<("");
    }
    else
    {
        cout<<"Incorrect Command, Please Try Again!\n";
        system("pause>>nul");
    }
        cout<<"Thank-you for you using Proby's Programs!";
        cout<<"Press any key to exit ...";
        system("pause>>nul");
        return 1;
}
Apr 24, 2011 at 3:41am
include #include <cstdlib>
Apr 24, 2011 at 1:01pm
thanks that helped fix one error however i still have 14 more errors that still pop up when i compile any other suggestions?
Last edited on Apr 24, 2011 at 1:01pm
Apr 24, 2011 at 1:18pm
nevermind i figured out that i typed some things wrong and i fixed so thanks!
Topic archived. No new replies allowed.