Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. system() parameter complications

system() parameter complications

Scheduled Pinned Locked Moved C / C++ / MFC
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gamefreak2291
    wrote on last edited by
    #1

    Alright, I'm trying to have my program, which was writting in C++ using Dev-Cpp 4.9.9.2, open a separate program. I know this can be achieved throw the use of system() but I can't seem to get it to work right, I'm currently using the command line:

    system("c:\\Program Files\\Internet Explorer\\iexplorer.exe");

    I get the error "'c:\Program' is not recognized as an internal or external command, operable program or batch file."

    S 1 Reply Last reply
    0
    • G gamefreak2291

      Alright, I'm trying to have my program, which was writting in C++ using Dev-Cpp 4.9.9.2, open a separate program. I know this can be achieved throw the use of system() but I can't seem to get it to work right, I'm currently using the command line:

      system("c:\\Program Files\\Internet Explorer\\iexplorer.exe");

      I get the error "'c:\Program' is not recognized as an internal or external command, operable program or batch file."

      S Offline
      S Offline
      Stuart Dootson
      wrote on last edited by
      #2
      1. It's just a command line, as passed to CMD, so put double quotes around the path as it contains spaces:

        system("\"c:\\Program Files\\Internet Explorer\\iexplorer.exe\"");

      2. Isn't it iexplore.exe, not iexplorer.exe?

      Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

      G 1 Reply Last reply
      0
      • S Stuart Dootson
        1. It's just a command line, as passed to CMD, so put double quotes around the path as it contains spaces:

          system("\"c:\\Program Files\\Internet Explorer\\iexplorer.exe\"");

        2. Isn't it iexplore.exe, not iexplorer.exe?

        Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

        G Offline
        G Offline
        gamefreak2291
        wrote on last edited by
        #3

        Thanks again Stuart really appreciating all the help you're giving me. That one worked perfect on the first try. I didn't know anything about double quotes until a little bit before i posted this issue. I looked up other examples on google and when I tried it with the double quotes before it told me the same issue. But having just tested it with the line still saying iexplorer instead of iexplore it gave the error again, so it looks like that was my issue.. really need to stop doing this at 2 am..

        S 1 Reply Last reply
        0
        • G gamefreak2291

          Thanks again Stuart really appreciating all the help you're giving me. That one worked perfect on the first try. I didn't know anything about double quotes until a little bit before i posted this issue. I looked up other examples on google and when I tried it with the double quotes before it told me the same issue. But having just tested it with the line still saying iexplorer instead of iexplore it gave the error again, so it looks like that was my issue.. really need to stop doing this at 2 am..

          S Offline
          S Offline
          Stuart Dootson
          wrote on last edited by
          #4

          The message you showed, saying that 'c:\Program' wasn't recognised, is a giveaway that you're having issues with spaces in the command-line. If you see it in the future, that's what your issue will be...

          Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups