title: How to run an exe using c prog
body: <p>I am new to this forum. I am in need of a program in C that runs an exe file in Windows.
  While googling I found the code below :</p>
  
  <p>1.
  Code:</p>
  
  <pre><code>#include&lt;stdlib.h&gt;
  #include&lt;stdio.h&gt;
  int main()
   {
    (void)system("C:\\Windows\\notepad.exe");
     return 0;
    }
  </code></pre>
  
  <p>The above code compiles successfully in Borland Turbo C. But it fails to run Notepad.</p>
  
  <p>2
  Code:</p>
  
  <pre><code>#include&lt;stdlib.h&gt;
  #include&lt;stdio.h&gt;
  void main()
   {
    int result ;
     result=system("C:\\Windows\\notepad.exe");
     printf("%d",result);
  
    }
  </code></pre>
  
  <p>The above code on running gives -1 as output. Why am I getting -1.</p>
  
  <p>My OS Windows XP
  Borland Turbo C Compiler</p>
  
  <p>Please help.</p>