The problem of multiple parameters passed in when writing a batch file

Source: Internet
Author: User
How to input multiple parameters when writing a batch file? Delphi/Windows SDK/API
Http://www.delphi2007.net/DelphiAPI/html/delphi_20061201225247135.html
My Program Callback calls a DOS program mydos.exe, which requires two parameters at the end of the program running. My current practice is: compile a program file mytext.txt and record the parameters to be input, such as "10 ", then write a BAT file as follows:
@ Echo off
Path/mydos.exe <path/mytest.txt

Then CreateProcess runs the BAT file, but the result is not running normally. I tried another dos program. The program needs to input parameters at the beginning and only has one parameter, but the result can run normally. My question is, is the input parameter time incorrect or is the input parameter method incorrect?

Thank you!

The dos folder separator should not be written in this way. It should be \

If there are not many parameters, you can call them as follows:
Path \ mydos.exe 10 10

Well, I haven't done batch processing for a long time. I will write a. The command in your bat file should be like this:

@ Echo off

@ For/F "delims =," % I in (mytest.txt) Do mydos.exe % I

Your mytest.txt content is: 10 10 (more parameters are available)

"Delims =," indicates that, when the separator is used, the read parameter is 10.

As for the path, you can do it yourself.


Mytest. BAT:

@ Echo off

@ For/F "delims =," % I in (mytest.txt) Do mydos.exe % I

Mytest. txt:

10 10

Myapplication:

Winexec (pchar (extractfilepath (application. exename) + 'mytest. bat'), sw_hide)

Cangwu_lee (small orange): path \ mydos.exe 10 NO! In addition, the path is correct. I wrote the "/" with my handwriting.

Sanmaotuo, it is not a parameter input from the beginning of the program.

I fixed it myself and closed the post!

How can I solve the problem? Thank you.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.