Jan 26, 2014 at 3:35pm UTC
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 Jan 28, 2014 at 10:35am UTC
Jan 26, 2014 at 3:46pm UTC
Is C:\\Computer a program?
Jan 26, 2014 at 3:47pm UTC
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 Jan 26, 2014 at 3:48pm UTC
Jan 28, 2014 at 10:37am UTC
I am using visual studio thats why,
I just want to open my computer,
I make a shortcut in C drive....
Jan 28, 2014 at 11:01am UTC
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.
Jan 28, 2014 at 11:04am UTC
Anyway, if you did want to run the shortcur, you need to specify C:\Computer.lnk instead (note the file extension).