Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6979857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:56:21+00:00 2026-05-27T17:56:21+00:00

Background Info: Windows 7, Visual C++ 2010 Express Problem: CreateProcess() keeps returning with ‘Invalid

  • 0

Background Info: Windows 7, Visual C++ 2010 Express

Problem: CreateProcess() keeps returning with ‘Invalid command line argument’

Explanation: I’m writing a piece of code that calls external programs using the Windows API’s CreateProcess. I’ve gotten the call to work with one external program so far:

if( !CreateProcess( "C:\\Temp\\convert.exe",
    t_str,        // Arguments
    ...
}
//where t_str is " C:\\img1.jpeg C:\\img1.pgm" (ImageMagick if you're wondering). 

This works perfectly even with the amount of data-mangling I did to push everything into the Windows strings and pointers. So I copied all of the mangling for CreateProcess() for another call to a different external program:

 if( !CreateProcess( "C:\\Temp\\sift.exe",
     t_str2,        // Arguments
     ...
 }
 //where t_str2 is ` < C:\\img1.pgm > C:\\img1.key`

Basically, something very similar, but with all the variable names changed (since I have these two calls running serial). And this is where the problem is; this doesn’t run, and, instead, prints out “Invalid command line argument: < C:\img1.pgm”. Of course, this command works fine in the command prompt, but not in my code.

I switched t_str2 to something else a little less complicated(since I know how sift.exe works) and I get the same result. Same thing happens when I run just sift and not convert.

Question: What could be causing this problem? What could I do to further debug this problem? Any suggestions on alternatives to the methods I’m using? Any help is appreciated. I can provide further code, but It’s pretty straight forward, and not much could go wrong with it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T17:56:22+00:00Added an answer on May 27, 2026 at 5:56 pm

    You cannot use command-line redirection operators with CreateProcess() directly. You have to spawn an instance of cmd.exe and pass the operators to it instead, eg:

    CreateProcess( "C:\\windows\\system32\\cmd.exe", t_str2, ...))
    

    Where t_str2 is "/C C:\\Temp\\sift.exe < C:\\img1.pgm > C:\\img1.key". The actual path to cmd.exe can be determined by reading the %COMSPEC% environment variable.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Background Info Developing with Windows Azure and WCF RIA Services, I have seen a
Background Info: File Replication is Lame Currently, we have a massive, high-traffic ASP.NET web
Background info : I was handed a Tool, which was made using MS-Access 2007,
Some background info; LanguageResource is the base class LanguageTranslatorResource and LanguageEditorResource inherit from LanguageResource
Can someone give me some info/background info on how I might go about writing
Please help! Background info I have a WPF application which accesses a SQL Server
Greetings, coders, Background Info and Code I am trying to create a daemon-type program
I am using the Google API V3 Infobox.js plugin to display custom info windows.
EDIT: Update - scroll down EDIT 2: Update - problem solved Some background information:
I need to create files inside of a specific folder (C:\Windows\System32\oobe\info\backgrounds) and possibly create

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.