Does anyone know about the SECOND part of the Process.start command, where you can set an argument for the process you're using

Robert Homes

Member
Joined
Nov 16, 2023
Messages
11
Programming Experience
5-10
I know there's a way to specify an argument to the Process.Start command -- such as "print" or "save" -- something that would be a good argument for whatever process you're wanting to start. But I don't remember how to specify that command or where to find the information. I want to use Process.Start to name a text file and have Process.Start call the correct program (usually Notepad.exe) to execute the process. But you can add someting to tell Notepad to print the file, not just open it. How do you do that?
 
What you're talking about are not commandline arguments but rather verbs. I believe that verbs are recorded in the Registry and Windows will display them in context menus for file types associated with that executable.

You can use the ProcessStartInfo.Verbs property to determine which verbs an executable supports and the ProcessStartInfo.Verb property to specify which of those to use when starting a process. For instance, I think you'll find that Notepad supports at least "print" and "printto".
 
Well, you obviously know what I'm talking about. But I still want to know HOW you specify the "verb" -- print, for instance -- when calling Process.Start, Where would I find that information?
 
You create and configure the ProcessStartInfo including setting the Verb property, and pass this to the Process.Start(ProcessStartInfo) method.

(alternative create a Process object, and configure through its StartInfo property which returns the ProcessStartInfo object)
 
As I said in my post, it's a property of the ProcessStartInfo class. If you had just searched the web for that class, you'd have found the documentation for it. I just searched on Bing (which I think is better for .NET development) for "vb.net processstartinfo" and it was the first result. You don't need any programming experience to search the web. Every .NET developer should favourite/bookmark the home page for the .NET documentation in their browser so they can go directly there and look up any type or member they need to. Apart from that, you can simply click on a type or member in the VS code window and press F1 to go straight to the relevant documentation. That might not be immediately obvious but context-sensitive Help has been a thing in Windows for decades, so it's not a stretch. ALWAYS read the relevant documentation. You won't always find what you need or understand what you find but you often will and the rate will increase as you use it. You will also often learn things that you weren't looking for but will be useful now or later.
 

Latest posts

Back
Top