views:

233

answers:

4

How can I find out the command line options a program was launched with under windows?

+7  A: 

try: http://www.bleepingcomputer.com/tutorials/tutorial132.html

in short: use the Process Explorer utility created by Sysinternals (now owned by Microsoft; which is probably why vista and windows 7 now have a similar functionality already present in task manager)

b0x0rz
BTW: SysInternals is now a part of Microsoft: http://technet.microsoft.com/en-us/sysinternals/default.aspx
M4N
A: 

Try running the .exe but with the /? flag.

samoz
no. these are the POSSIBLE options. the question was AFTER the app started, what options WERE used.
b0x0rz
+3  A: 

On vista... You can

  • go to the task manager
  • Click View --> Select Columns
  • Add the command line column.

To do this programatically, run "tasklist -v" to a file and then split up the file.

seanyboy
A: 

If you are trying to get the command line of another process programmatically you should probably read Why is there no supported way to get the command line of another process?:

Commenter Francisco Moraes wonders whether there is a supported way of getting the command line of another process. Although there are certainly unsupported ways of doing it or ways that work with the assistance of a debugger, there's nothing that is supported for programmatic access to another process's command line, at least nothing provided by the kernel. (The WMI folks have come up with Win32_Process.CommandLine. I have no idea how they get that. You'll have to ask them yourself.)

If you are trying to retrieve the command line of your own process you can use GetCommandLine.

Grant Wagner