Internal or External command

runtime error
"not recognized as an internal or external command, operable program or batch file"
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# include <stdio.h>
# include <stdlib.h>
# include "iostream"
using namespace std;
int main()
{
    char ch;
    cout<<"Do you want to Open computer now(y / n) \n " ;
    cin >> ch;
        if (ch == 'y' || ch == 'Y'){
            system("C:\\Computer");
            cin >> ch;
            ch=getchar();
        }
        else
            cout << "Not Working";
        system("pause");
        return 0;
}
Last edited on
Is C:\\Computer a program?
1
2
if (ch == 'y' || ch == 'Y'){
    system("C:\\Computer");

When I open up a cmd.exe window and type in "C:\Computer", this is what I get:
'C:\Computer' is not recognized as an internal or external command,
operable program or batch file.

What were you expecting?

To log off, use shutdown -l, and if you want to shut down, use shutdown -s (or shutdown -r to reboot).

Also, what's up with the #include "iostream" ?
What's wrong with
1
2
3
#include <cstdio>
#include <cstdlib>
#include <iostream> 
?
Last edited on
I am using visual studio thats why,
I just want to open my computer,
I make a shortcut in C drive....
My Computer is a virtual folder which only the shell understands(typically explorer.exe) which have a specific GUID.
To open it launch explorer.exe with a specific command line switch.
Anyway, if you did want to run the shortcur, you need to specify C:\Computer.lnk instead (note the file extension).
Topic archived. No new replies allowed.