C # Enter characters into a batch file

Source: Internet
Author: User

First record a irrelevant title ~

Just learning to use C #, when programming with VS for graphical interfaces, add space to the point interface, and the control's property page appears on the right side of the VS interface, but this property page is not full,

Only some of the important properties are listed, at first it was thought that there is no corresponding property method, and then went to Baidu found this attribute, but not every time Baidu so troublesome it,

Ask a colleague and know that there are two ways to see all the properties of a control:

One is to enter the name of the control when editing in VS and., the list that comes out is all attributes;

Another is to view MSDN, enter the name of the control, and view the members.

————————————————————————————————————————————————————————————

The requirement is this: Enter the parameters in the C # tool, click on the button, call bat and pass the parameters just entered into the bat to execute.

It was considered whether it was necessary to manually set the bat to the active window after calling up the bat, and then send the parameters, but later found a bit of trouble,

Need FindWindow, Setforeground and so on, try to do not succeed so give up. Thought for a moment,

Generally pull out the bat after not move, should focus on the bat. Just need:

1 Process.Start (a.txt); 2 sendkeys.sendwait (PAR1); 3 sendkeys.sendwait ({ENTER}");

Try it out in VS and it works.

But there is a small problem, when you double-click the compiled EXE, the card in the bat interface does not have input parameters, why?

Guess, when the external environment is running, the active window is not bat when the parameter is entered, and the pass is a bit slow.

Try adding a sentence between lines 1 and 2:

Thread.Sleep (+);

After compiling, double-click EXE, successful, can normally input parameters to bat.

One problem occurred several times, not resolved, recorded: For example, to bat input 0, there may be two 0~

C # Enter characters into a batch file

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.