简体   繁体   中英

How to use more than one verb when starting a process?

Currently I am just printing a doc file using the following code:

System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo = new System.Diagnostics.ProcessStartInfo()
{
    CreateNoWindow = false,
    Verb = "print",
    FileName = fileName //put the correct path here
};
p.Start();

What can I do so that I can keep the file open after printing or the other way around open the file first and then print it. Can I use more then one verb with a process?

You can't.

Verbs are implemented as complete command lines: each verb corresponds to a full command-line, defined in the registry. Thus, each new verb would start an entirely different process, just happening to (usually) point to the same executable binary with different command-line args.

To control an application in more detail, you would have to resort to the program's automation technique, if there is one.

You can read more about it here and here :

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM