468,512 Members | 1,360 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,512 developers. It's quick & easy.

Problems using ShellExecute

1
Hi,

I just need to open command promp from C++. This is the current code I am using but i get a load of errors.
Expand|Select|Wrap|Line Numbers
  1. #include <shellapi.h>
  2.  
  3.  
  4. int main()
  5. {
  6.     ShellExecute(NULL, "open", 
  7.     "C:\Documents and Settings\04714975\Start Menu\Programs\Accessories\cmd.exe", "cd", NULL, SW_SHOW)
  8.  
  9.  
  10.  
  11.  return 0;
  12. }
Oct 11 '06 #1
2 15679
Banfa
9,056 Expert Mod 8TB
If you are getting errors you should post them.

Cmd.exe is not in the directory you have given, that is a link. It is in

C:\WINDOWS\system32\cmd.exe

Where C:\WINDOWS may be different on your system but is the "Windows" directory.
Oct 11 '06 #2
Hi,

I just need to open command promp from C++. This is the current code I am using but i get a load of errors.


#include <shellapi.h>


int main()
{
ShellExecute(NULL, "open",
"C:\Documents and Settings\04714975\Start Menu\Programs\Accessories\cmd.exe", "cd", NULL, SW_SHOW)



return 0;
}

you can use this

#include<stdlib.h>
int main()
{
system("start cmd");
return 0;
}
Oct 11 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by Marcel Sammut | last post: by
2 posts views Thread by scrimp | last post: by
3 posts views Thread by Wiktor Zychla | last post: by
11 posts views Thread by Le, Thanh-Nhan | last post: by
1 post views Thread by bugs bunny via .NET 247 | last post: by
5 posts views Thread by Jedi10180 | last post: by
2 posts views Thread by John Smith | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.