Problems using ShellExecute

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Rod
    New Member
    • Oct 2006
    • 1

    Problems using ShellExecute

    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.
    Code:
    #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;
    }
    Last edited by Niheel; Aug 4 '11, 04:58 AM.
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    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\syst em32\cmd.exe

    Where C:\WINDOWS may be different on your system but is the "Windows" directory.

    Comment

    • zahidkhan
      New Member
      • Sep 2006
      • 22

      #3
      Originally posted by Rod
      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(NU LL, "open",
      "C:\Documen ts and Settings\047149 75\Start Menu\Programs\A ccessories\cmd. exe", "cd", NULL, SW_SHOW)



      return 0;
      }

      you can use this

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

      Comment

      Working...