How do I find out command line arguments of a running program?Get the complete command line of a processHow...
Why was Germany not as successful as other Europeans in establishing overseas colonies?
Sci fi novel series with instant travel between planets through gates. A river runs through the gates
What is the strongest case that can be made in favour of the UK regaining some control over fishing policy after Brexit?
Was there a shared-world project before "Thieves World"?
What's the polite way to say "I need to urinate"?
Why does nature favour the Laplacian?
With a Canadian student visa, can I spend a night at Vancouver before continuing to Toronto?
Why is it that the natural deduction method can't test for invalidity?
Repelling Blast: Must targets always be pushed back?
How can Republicans who favour free markets, consistently express anger when they don't like the outcome of that choice?
Contradiction proof for inequality of P and NP?
How come there are so many candidates for the 2020 Democratic party presidential nomination?
Which big number is bigger?
Will tsunami waves travel forever if there was no land?
Using a Lyapunov function to classify stability and sketching a phase portrait
How to creep the reader out with what seems like a normal person?
Does holding a wand and speaking its command word count as V/S/M spell components?
What are the potential pitfalls when using metals as a currency?
Can someone publish a story that happened to you?
How can the Zone of Truth spell be defeated without the caster knowing?
How would one muzzle a full grown polar bear in the 13th century?
Don’t seats that recline flat defeat the purpose of having seatbelts?
Please, smoke with good manners
Error message with tabularx
How do I find out command line arguments of a running program?
Get the complete command line of a processHow to capture command line parameters for new processes?How do I see what arguments with which a running program was launched in an external cmd prompt?Give each NodeJs Process a name in Windows TaskListHow do you open the command prompt in Windows 7 with a shortcut key?Obtaining all command line parameters in CMD promptWhat VmWare VM is associated with a Process (pid) (on Windows Host)?How to I add command line arguments (parameters) for pinned applications on Windows 7?Pass command line arguments to Windows “Open With”Redirecting input from file to command-line programHow to pass command line arguments in Mac ApplicationHow to add command line arguments to command line arguments in Windows shortcut?How to capture command line parameters for new processes?How to get the command line of a running application?Passing Command Line Arguments to EXEHow would I know possible combinations of parameters an exe file ran via cmd can take?How to suppress the “Quick Compare” dialog window when running from command line?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I'm looking for a tool or method to find out what command line parameters have been passed to a program, for example when it was run by another program (launcher-application scenario).
windows-7 windows command-line-arguments
add a comment |
I'm looking for a tool or method to find out what command line parameters have been passed to a program, for example when it was run by another program (launcher-application scenario).
windows-7 windows command-line-arguments
add a comment |
I'm looking for a tool or method to find out what command line parameters have been passed to a program, for example when it was run by another program (launcher-application scenario).
windows-7 windows command-line-arguments
I'm looking for a tool or method to find out what command line parameters have been passed to a program, for example when it was run by another program (launcher-application scenario).
windows-7 windows command-line-arguments
windows-7 windows command-line-arguments
asked Apr 22 '12 at 14:36
GepardGepard
6272915
6272915
add a comment |
add a comment |
7 Answers
7
active
oldest
votes
You can do that using Process Explorer.
Just hover with your mouse over a process to see the command line arguments used to start it:
Alternatively, you can open the properties of the process and inspect the command line right there:
2
That's really cool.
– cutrightjm
Apr 22 '12 at 15:23
2
Unfortunately, it doesn't seem to work with applications protected with WinLicense/Themida: oreans.com/winlicense.php Any other ideas?
– Gepard
Apr 22 '12 at 16:24
@Gepard: How do you know it doesn't work? Are you sure the application was, in fact, called with command line arguments? Either way, PE uses the Windows way of determining that information. Anything else would have to be custom-tailored to a specific application, I assume.
– Der Hochstapler
Apr 22 '12 at 16:37
6
My bad, it didn't run PE elevated. It's working as intended.
– Gepard
Apr 22 '12 at 16:46
@OliverSalzburg, How did this program work? Can any normal C program achieve this?
– Pacerier
Jan 20 '15 at 3:17
|
show 2 more comments
You can do it without Process Explorer, too, using Windows' WMI service. Run the following from the command prompt:
WMIC path win32_process get Caption,Processid,Commandline
If you want to dump the output to a file (makes it a bit easier to read), use the /OUTPUT switch:
WMIC /OUTPUT:C:Process.txt path win32_process get Caption,Processid,Commandline
4
Nice, how did you know this?
– Pacerier
Jan 20 '15 at 3:18
4
@Pacerier: I'm not sure to be honest ;-) I think it came from digging around the WMI docs and playing around because I needed to use WMI for something at the time.
– Andy E
Jan 20 '15 at 9:06
3
Which WMI docs are you referring to?
– Pacerier
Jan 22 '15 at 3:48
2
This was a very helpful command line method for getting the command line of a running process. In my case, I was able to tweak this slightly to get output just for a specific process: WMIC path win32_process where "caption='cmd.exe'" get Commandline
– chriv
Mar 30 '16 at 17:32
1
Great, and the where clause actually support some SQL features, e.g., where "name like 'cmd.%'
– zhaorufei
Aug 31 '16 at 6:25
|
show 4 more comments
One can also achieve that by using Task Manager.
Open task manager (by CTRL-SHIFT-ESC, CTRL-ALT-DELETE or any other method).
For Windows 7 (and probably Windows XP):
- Go to "Processes" tab. The on the "View" menu, select "Select Columns...".
- Check the checkbox of "Command Line" and click OK. (You may have to scroll down to find it)
For Windows 8:
- Go to "Details" tab. Right-click on any of the columns (eg. Names, PID etc.) and select "Select columns".
- Check the checkbox of "Command Line" and click OK. (You may have to scroll down to find it)
A column of Command lines of will be added to the currently displayed columns.
1
I don't really get you @JesseBarnum, one can always resize the column to have a complete view no matter how long the command line is, right?
– Jeromy Adofo
Dec 7 '15 at 0:35
1
Only if the window is wide enough for the size of the command. If the command is something like a Java process with a long classpath, that won't fit in the window width.
– Jesse Barnum
Dec 7 '15 at 16:03
1
Alright thanks, noted. I haven't had that problem though and by the way my task manager is scrollable - don't know about yours :-). I think if you can send me a sample program to try, that could settle it.
– Jeromy Adofo
Dec 18 '15 at 16:57
5
This is a vastly underrated answer, had no idea this was possible.
– Hashim
Mar 13 '17 at 23:34
3
I see a couple of comments above about the Windows Task Manager. Even if you set the 'Command line' column to show a Java process with a really long command line will get truncated. BUT, you can click on the row in the Task Manager and 'copy' (Ctrl-c) the whole row and paste this into a text editor to see the whole command line, no matter how long.
– JohnD
Feb 21 '18 at 2:43
|
show 6 more comments
PowerShell to the rescue.
Find:
Get-WmiObject Win32_Process -Filter "name = 'perl.exe'" | where {$_.CommandLine -eq '"C:strawberryperlbinperl.exe" t/Server_PreFork.t'}
And kill as bonus:
Get-WmiObject Win32_Process -Filter "name = 'perl.exe'" | where {$_.CommandLine -eq '"C:strawberryperlbinperl.exe" t/Server_PreFork.t'} | ForEach-Object { Invoke-WmiMethod -Path $_.__Path –Name Terminate }
You can run it from powershell directly or from a ps1 if you've got your system setup. I detail unrestricted script setup on i kill zombies with powershell as well as other powershell tricks...
1
Whoa... the kill part is quite dangerous, given the title of the question ;) Otheriwse a very neat answer ;)
– Tom
Aug 23 '17 at 14:14
add a comment |
Previous answers are great in case the process is already running and is not going to terminate any soon. However If you need (as I did) to do this perhaps with processses start up multiple times and/or quickly terminate, or perhaps log occurences in a longer period of time, there is a way to this using Process Monitor.
Basically it logs various events in the system, in this case we can just filter the "Process Start" event and the name of the process we want to monitor, as shown below:
Then just keep the process monitor running and do whatever you do to get the process you want to log running. You can see in either the "Detail" column or the "Command line" column (depends on how you configure those) the command line arguments. For example:
Of course this way you can extract much more related information such as what is the working directory, what environment variables have been passed on the process, etc... Also it is easy to export the results into a file.
add a comment |
When using CygWin, if I start a Python process, this is an example of command line:
c:CygWinbinpython2.7.exe /usr/local/bin/sudoserver.py
But Process Explorer only sees the main exe:
(note the "path: [Error opening process message]" (see EDIT-1)).
Same results for tasklist
:
C:>tasklist | find "python" /i
python2.7.exe 5740 Console 1 15.312 KB
So, the only trick I know until now, is finding it via CygWin Bash shell pgrep
:
Luis@Kenobi /cygdrive/c/
$ pgrep -f -l server.py
5740 /usr/bin/python2.7 /usr/local/bin/sudoserver.py
It is useful to know this, as long as CygWin cohabits with no problems in Windows, and you can use it to run many POSIX and Python programs.
EDIT: In Windows you don't seem to need administrator priviledges for tasklist. In CygWin you will need them to be able to view an administrator's process (what seems more logical to me: the full command-line could have some parameters like passwords inside), so we must run the CygWin Bash in elevated Administrator Mode.
EDIT-1: This problem will not happen if you run Process Explorer as administrator. Thanks you for pointing, @Pacerier.
2
If you run as administrator you wouldn't be seeing[Error opening process message]
– Pacerier
Jan 20 '15 at 3:20
You were right, @Pacerier . Too obvious to remember :-) . Thanks you. I have edited my post to reflect it.
– Sopalajo de Arrierez
Jan 20 '15 at 3:30
add a comment |
go to run
or goto start
and search:
tasklist -m
tasklist -svc
5
That does not show the calling command line./m
shows loaded modules (DLLs, etc.) and/svc
shows services hosted in each process.
– Bob
Nov 2 '12 at 5:02
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f415360%2fhow-do-i-find-out-command-line-arguments-of-a-running-program%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
7 Answers
7
active
oldest
votes
7 Answers
7
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can do that using Process Explorer.
Just hover with your mouse over a process to see the command line arguments used to start it:
Alternatively, you can open the properties of the process and inspect the command line right there:
2
That's really cool.
– cutrightjm
Apr 22 '12 at 15:23
2
Unfortunately, it doesn't seem to work with applications protected with WinLicense/Themida: oreans.com/winlicense.php Any other ideas?
– Gepard
Apr 22 '12 at 16:24
@Gepard: How do you know it doesn't work? Are you sure the application was, in fact, called with command line arguments? Either way, PE uses the Windows way of determining that information. Anything else would have to be custom-tailored to a specific application, I assume.
– Der Hochstapler
Apr 22 '12 at 16:37
6
My bad, it didn't run PE elevated. It's working as intended.
– Gepard
Apr 22 '12 at 16:46
@OliverSalzburg, How did this program work? Can any normal C program achieve this?
– Pacerier
Jan 20 '15 at 3:17
|
show 2 more comments
You can do that using Process Explorer.
Just hover with your mouse over a process to see the command line arguments used to start it:
Alternatively, you can open the properties of the process and inspect the command line right there:
2
That's really cool.
– cutrightjm
Apr 22 '12 at 15:23
2
Unfortunately, it doesn't seem to work with applications protected with WinLicense/Themida: oreans.com/winlicense.php Any other ideas?
– Gepard
Apr 22 '12 at 16:24
@Gepard: How do you know it doesn't work? Are you sure the application was, in fact, called with command line arguments? Either way, PE uses the Windows way of determining that information. Anything else would have to be custom-tailored to a specific application, I assume.
– Der Hochstapler
Apr 22 '12 at 16:37
6
My bad, it didn't run PE elevated. It's working as intended.
– Gepard
Apr 22 '12 at 16:46
@OliverSalzburg, How did this program work? Can any normal C program achieve this?
– Pacerier
Jan 20 '15 at 3:17
|
show 2 more comments
You can do that using Process Explorer.
Just hover with your mouse over a process to see the command line arguments used to start it:
Alternatively, you can open the properties of the process and inspect the command line right there:
You can do that using Process Explorer.
Just hover with your mouse over a process to see the command line arguments used to start it:
Alternatively, you can open the properties of the process and inspect the command line right there:
answered Apr 22 '12 at 14:39
Der HochstaplerDer Hochstapler
68.6k50232288
68.6k50232288
2
That's really cool.
– cutrightjm
Apr 22 '12 at 15:23
2
Unfortunately, it doesn't seem to work with applications protected with WinLicense/Themida: oreans.com/winlicense.php Any other ideas?
– Gepard
Apr 22 '12 at 16:24
@Gepard: How do you know it doesn't work? Are you sure the application was, in fact, called with command line arguments? Either way, PE uses the Windows way of determining that information. Anything else would have to be custom-tailored to a specific application, I assume.
– Der Hochstapler
Apr 22 '12 at 16:37
6
My bad, it didn't run PE elevated. It's working as intended.
– Gepard
Apr 22 '12 at 16:46
@OliverSalzburg, How did this program work? Can any normal C program achieve this?
– Pacerier
Jan 20 '15 at 3:17
|
show 2 more comments
2
That's really cool.
– cutrightjm
Apr 22 '12 at 15:23
2
Unfortunately, it doesn't seem to work with applications protected with WinLicense/Themida: oreans.com/winlicense.php Any other ideas?
– Gepard
Apr 22 '12 at 16:24
@Gepard: How do you know it doesn't work? Are you sure the application was, in fact, called with command line arguments? Either way, PE uses the Windows way of determining that information. Anything else would have to be custom-tailored to a specific application, I assume.
– Der Hochstapler
Apr 22 '12 at 16:37
6
My bad, it didn't run PE elevated. It's working as intended.
– Gepard
Apr 22 '12 at 16:46
@OliverSalzburg, How did this program work? Can any normal C program achieve this?
– Pacerier
Jan 20 '15 at 3:17
2
2
That's really cool.
– cutrightjm
Apr 22 '12 at 15:23
That's really cool.
– cutrightjm
Apr 22 '12 at 15:23
2
2
Unfortunately, it doesn't seem to work with applications protected with WinLicense/Themida: oreans.com/winlicense.php Any other ideas?
– Gepard
Apr 22 '12 at 16:24
Unfortunately, it doesn't seem to work with applications protected with WinLicense/Themida: oreans.com/winlicense.php Any other ideas?
– Gepard
Apr 22 '12 at 16:24
@Gepard: How do you know it doesn't work? Are you sure the application was, in fact, called with command line arguments? Either way, PE uses the Windows way of determining that information. Anything else would have to be custom-tailored to a specific application, I assume.
– Der Hochstapler
Apr 22 '12 at 16:37
@Gepard: How do you know it doesn't work? Are you sure the application was, in fact, called with command line arguments? Either way, PE uses the Windows way of determining that information. Anything else would have to be custom-tailored to a specific application, I assume.
– Der Hochstapler
Apr 22 '12 at 16:37
6
6
My bad, it didn't run PE elevated. It's working as intended.
– Gepard
Apr 22 '12 at 16:46
My bad, it didn't run PE elevated. It's working as intended.
– Gepard
Apr 22 '12 at 16:46
@OliverSalzburg, How did this program work? Can any normal C program achieve this?
– Pacerier
Jan 20 '15 at 3:17
@OliverSalzburg, How did this program work? Can any normal C program achieve this?
– Pacerier
Jan 20 '15 at 3:17
|
show 2 more comments
You can do it without Process Explorer, too, using Windows' WMI service. Run the following from the command prompt:
WMIC path win32_process get Caption,Processid,Commandline
If you want to dump the output to a file (makes it a bit easier to read), use the /OUTPUT switch:
WMIC /OUTPUT:C:Process.txt path win32_process get Caption,Processid,Commandline
4
Nice, how did you know this?
– Pacerier
Jan 20 '15 at 3:18
4
@Pacerier: I'm not sure to be honest ;-) I think it came from digging around the WMI docs and playing around because I needed to use WMI for something at the time.
– Andy E
Jan 20 '15 at 9:06
3
Which WMI docs are you referring to?
– Pacerier
Jan 22 '15 at 3:48
2
This was a very helpful command line method for getting the command line of a running process. In my case, I was able to tweak this slightly to get output just for a specific process: WMIC path win32_process where "caption='cmd.exe'" get Commandline
– chriv
Mar 30 '16 at 17:32
1
Great, and the where clause actually support some SQL features, e.g., where "name like 'cmd.%'
– zhaorufei
Aug 31 '16 at 6:25
|
show 4 more comments
You can do it without Process Explorer, too, using Windows' WMI service. Run the following from the command prompt:
WMIC path win32_process get Caption,Processid,Commandline
If you want to dump the output to a file (makes it a bit easier to read), use the /OUTPUT switch:
WMIC /OUTPUT:C:Process.txt path win32_process get Caption,Processid,Commandline
4
Nice, how did you know this?
– Pacerier
Jan 20 '15 at 3:18
4
@Pacerier: I'm not sure to be honest ;-) I think it came from digging around the WMI docs and playing around because I needed to use WMI for something at the time.
– Andy E
Jan 20 '15 at 9:06
3
Which WMI docs are you referring to?
– Pacerier
Jan 22 '15 at 3:48
2
This was a very helpful command line method for getting the command line of a running process. In my case, I was able to tweak this slightly to get output just for a specific process: WMIC path win32_process where "caption='cmd.exe'" get Commandline
– chriv
Mar 30 '16 at 17:32
1
Great, and the where clause actually support some SQL features, e.g., where "name like 'cmd.%'
– zhaorufei
Aug 31 '16 at 6:25
|
show 4 more comments
You can do it without Process Explorer, too, using Windows' WMI service. Run the following from the command prompt:
WMIC path win32_process get Caption,Processid,Commandline
If you want to dump the output to a file (makes it a bit easier to read), use the /OUTPUT switch:
WMIC /OUTPUT:C:Process.txt path win32_process get Caption,Processid,Commandline
You can do it without Process Explorer, too, using Windows' WMI service. Run the following from the command prompt:
WMIC path win32_process get Caption,Processid,Commandline
If you want to dump the output to a file (makes it a bit easier to read), use the /OUTPUT switch:
WMIC /OUTPUT:C:Process.txt path win32_process get Caption,Processid,Commandline
edited Dec 15 '12 at 20:36
answered Dec 15 '12 at 17:29
Andy EAndy E
958611
958611
4
Nice, how did you know this?
– Pacerier
Jan 20 '15 at 3:18
4
@Pacerier: I'm not sure to be honest ;-) I think it came from digging around the WMI docs and playing around because I needed to use WMI for something at the time.
– Andy E
Jan 20 '15 at 9:06
3
Which WMI docs are you referring to?
– Pacerier
Jan 22 '15 at 3:48
2
This was a very helpful command line method for getting the command line of a running process. In my case, I was able to tweak this slightly to get output just for a specific process: WMIC path win32_process where "caption='cmd.exe'" get Commandline
– chriv
Mar 30 '16 at 17:32
1
Great, and the where clause actually support some SQL features, e.g., where "name like 'cmd.%'
– zhaorufei
Aug 31 '16 at 6:25
|
show 4 more comments
4
Nice, how did you know this?
– Pacerier
Jan 20 '15 at 3:18
4
@Pacerier: I'm not sure to be honest ;-) I think it came from digging around the WMI docs and playing around because I needed to use WMI for something at the time.
– Andy E
Jan 20 '15 at 9:06
3
Which WMI docs are you referring to?
– Pacerier
Jan 22 '15 at 3:48
2
This was a very helpful command line method for getting the command line of a running process. In my case, I was able to tweak this slightly to get output just for a specific process: WMIC path win32_process where "caption='cmd.exe'" get Commandline
– chriv
Mar 30 '16 at 17:32
1
Great, and the where clause actually support some SQL features, e.g., where "name like 'cmd.%'
– zhaorufei
Aug 31 '16 at 6:25
4
4
Nice, how did you know this?
– Pacerier
Jan 20 '15 at 3:18
Nice, how did you know this?
– Pacerier
Jan 20 '15 at 3:18
4
4
@Pacerier: I'm not sure to be honest ;-) I think it came from digging around the WMI docs and playing around because I needed to use WMI for something at the time.
– Andy E
Jan 20 '15 at 9:06
@Pacerier: I'm not sure to be honest ;-) I think it came from digging around the WMI docs and playing around because I needed to use WMI for something at the time.
– Andy E
Jan 20 '15 at 9:06
3
3
Which WMI docs are you referring to?
– Pacerier
Jan 22 '15 at 3:48
Which WMI docs are you referring to?
– Pacerier
Jan 22 '15 at 3:48
2
2
This was a very helpful command line method for getting the command line of a running process. In my case, I was able to tweak this slightly to get output just for a specific process: WMIC path win32_process where "caption='cmd.exe'" get Commandline
– chriv
Mar 30 '16 at 17:32
This was a very helpful command line method for getting the command line of a running process. In my case, I was able to tweak this slightly to get output just for a specific process: WMIC path win32_process where "caption='cmd.exe'" get Commandline
– chriv
Mar 30 '16 at 17:32
1
1
Great, and the where clause actually support some SQL features, e.g., where "name like 'cmd.%'
– zhaorufei
Aug 31 '16 at 6:25
Great, and the where clause actually support some SQL features, e.g., where "name like 'cmd.%'
– zhaorufei
Aug 31 '16 at 6:25
|
show 4 more comments
One can also achieve that by using Task Manager.
Open task manager (by CTRL-SHIFT-ESC, CTRL-ALT-DELETE or any other method).
For Windows 7 (and probably Windows XP):
- Go to "Processes" tab. The on the "View" menu, select "Select Columns...".
- Check the checkbox of "Command Line" and click OK. (You may have to scroll down to find it)
For Windows 8:
- Go to "Details" tab. Right-click on any of the columns (eg. Names, PID etc.) and select "Select columns".
- Check the checkbox of "Command Line" and click OK. (You may have to scroll down to find it)
A column of Command lines of will be added to the currently displayed columns.
1
I don't really get you @JesseBarnum, one can always resize the column to have a complete view no matter how long the command line is, right?
– Jeromy Adofo
Dec 7 '15 at 0:35
1
Only if the window is wide enough for the size of the command. If the command is something like a Java process with a long classpath, that won't fit in the window width.
– Jesse Barnum
Dec 7 '15 at 16:03
1
Alright thanks, noted. I haven't had that problem though and by the way my task manager is scrollable - don't know about yours :-). I think if you can send me a sample program to try, that could settle it.
– Jeromy Adofo
Dec 18 '15 at 16:57
5
This is a vastly underrated answer, had no idea this was possible.
– Hashim
Mar 13 '17 at 23:34
3
I see a couple of comments above about the Windows Task Manager. Even if you set the 'Command line' column to show a Java process with a really long command line will get truncated. BUT, you can click on the row in the Task Manager and 'copy' (Ctrl-c) the whole row and paste this into a text editor to see the whole command line, no matter how long.
– JohnD
Feb 21 '18 at 2:43
|
show 6 more comments
One can also achieve that by using Task Manager.
Open task manager (by CTRL-SHIFT-ESC, CTRL-ALT-DELETE or any other method).
For Windows 7 (and probably Windows XP):
- Go to "Processes" tab. The on the "View" menu, select "Select Columns...".
- Check the checkbox of "Command Line" and click OK. (You may have to scroll down to find it)
For Windows 8:
- Go to "Details" tab. Right-click on any of the columns (eg. Names, PID etc.) and select "Select columns".
- Check the checkbox of "Command Line" and click OK. (You may have to scroll down to find it)
A column of Command lines of will be added to the currently displayed columns.
1
I don't really get you @JesseBarnum, one can always resize the column to have a complete view no matter how long the command line is, right?
– Jeromy Adofo
Dec 7 '15 at 0:35
1
Only if the window is wide enough for the size of the command. If the command is something like a Java process with a long classpath, that won't fit in the window width.
– Jesse Barnum
Dec 7 '15 at 16:03
1
Alright thanks, noted. I haven't had that problem though and by the way my task manager is scrollable - don't know about yours :-). I think if you can send me a sample program to try, that could settle it.
– Jeromy Adofo
Dec 18 '15 at 16:57
5
This is a vastly underrated answer, had no idea this was possible.
– Hashim
Mar 13 '17 at 23:34
3
I see a couple of comments above about the Windows Task Manager. Even if you set the 'Command line' column to show a Java process with a really long command line will get truncated. BUT, you can click on the row in the Task Manager and 'copy' (Ctrl-c) the whole row and paste this into a text editor to see the whole command line, no matter how long.
– JohnD
Feb 21 '18 at 2:43
|
show 6 more comments
One can also achieve that by using Task Manager.
Open task manager (by CTRL-SHIFT-ESC, CTRL-ALT-DELETE or any other method).
For Windows 7 (and probably Windows XP):
- Go to "Processes" tab. The on the "View" menu, select "Select Columns...".
- Check the checkbox of "Command Line" and click OK. (You may have to scroll down to find it)
For Windows 8:
- Go to "Details" tab. Right-click on any of the columns (eg. Names, PID etc.) and select "Select columns".
- Check the checkbox of "Command Line" and click OK. (You may have to scroll down to find it)
A column of Command lines of will be added to the currently displayed columns.
One can also achieve that by using Task Manager.
Open task manager (by CTRL-SHIFT-ESC, CTRL-ALT-DELETE or any other method).
For Windows 7 (and probably Windows XP):
- Go to "Processes" tab. The on the "View" menu, select "Select Columns...".
- Check the checkbox of "Command Line" and click OK. (You may have to scroll down to find it)
For Windows 8:
- Go to "Details" tab. Right-click on any of the columns (eg. Names, PID etc.) and select "Select columns".
- Check the checkbox of "Command Line" and click OK. (You may have to scroll down to find it)
A column of Command lines of will be added to the currently displayed columns.
answered Oct 3 '15 at 7:28
Jeromy AdofoJeromy Adofo
43143
43143
1
I don't really get you @JesseBarnum, one can always resize the column to have a complete view no matter how long the command line is, right?
– Jeromy Adofo
Dec 7 '15 at 0:35
1
Only if the window is wide enough for the size of the command. If the command is something like a Java process with a long classpath, that won't fit in the window width.
– Jesse Barnum
Dec 7 '15 at 16:03
1
Alright thanks, noted. I haven't had that problem though and by the way my task manager is scrollable - don't know about yours :-). I think if you can send me a sample program to try, that could settle it.
– Jeromy Adofo
Dec 18 '15 at 16:57
5
This is a vastly underrated answer, had no idea this was possible.
– Hashim
Mar 13 '17 at 23:34
3
I see a couple of comments above about the Windows Task Manager. Even if you set the 'Command line' column to show a Java process with a really long command line will get truncated. BUT, you can click on the row in the Task Manager and 'copy' (Ctrl-c) the whole row and paste this into a text editor to see the whole command line, no matter how long.
– JohnD
Feb 21 '18 at 2:43
|
show 6 more comments
1
I don't really get you @JesseBarnum, one can always resize the column to have a complete view no matter how long the command line is, right?
– Jeromy Adofo
Dec 7 '15 at 0:35
1
Only if the window is wide enough for the size of the command. If the command is something like a Java process with a long classpath, that won't fit in the window width.
– Jesse Barnum
Dec 7 '15 at 16:03
1
Alright thanks, noted. I haven't had that problem though and by the way my task manager is scrollable - don't know about yours :-). I think if you can send me a sample program to try, that could settle it.
– Jeromy Adofo
Dec 18 '15 at 16:57
5
This is a vastly underrated answer, had no idea this was possible.
– Hashim
Mar 13 '17 at 23:34
3
I see a couple of comments above about the Windows Task Manager. Even if you set the 'Command line' column to show a Java process with a really long command line will get truncated. BUT, you can click on the row in the Task Manager and 'copy' (Ctrl-c) the whole row and paste this into a text editor to see the whole command line, no matter how long.
– JohnD
Feb 21 '18 at 2:43
1
1
I don't really get you @JesseBarnum, one can always resize the column to have a complete view no matter how long the command line is, right?
– Jeromy Adofo
Dec 7 '15 at 0:35
I don't really get you @JesseBarnum, one can always resize the column to have a complete view no matter how long the command line is, right?
– Jeromy Adofo
Dec 7 '15 at 0:35
1
1
Only if the window is wide enough for the size of the command. If the command is something like a Java process with a long classpath, that won't fit in the window width.
– Jesse Barnum
Dec 7 '15 at 16:03
Only if the window is wide enough for the size of the command. If the command is something like a Java process with a long classpath, that won't fit in the window width.
– Jesse Barnum
Dec 7 '15 at 16:03
1
1
Alright thanks, noted. I haven't had that problem though and by the way my task manager is scrollable - don't know about yours :-). I think if you can send me a sample program to try, that could settle it.
– Jeromy Adofo
Dec 18 '15 at 16:57
Alright thanks, noted. I haven't had that problem though and by the way my task manager is scrollable - don't know about yours :-). I think if you can send me a sample program to try, that could settle it.
– Jeromy Adofo
Dec 18 '15 at 16:57
5
5
This is a vastly underrated answer, had no idea this was possible.
– Hashim
Mar 13 '17 at 23:34
This is a vastly underrated answer, had no idea this was possible.
– Hashim
Mar 13 '17 at 23:34
3
3
I see a couple of comments above about the Windows Task Manager. Even if you set the 'Command line' column to show a Java process with a really long command line will get truncated. BUT, you can click on the row in the Task Manager and 'copy' (Ctrl-c) the whole row and paste this into a text editor to see the whole command line, no matter how long.
– JohnD
Feb 21 '18 at 2:43
I see a couple of comments above about the Windows Task Manager. Even if you set the 'Command line' column to show a Java process with a really long command line will get truncated. BUT, you can click on the row in the Task Manager and 'copy' (Ctrl-c) the whole row and paste this into a text editor to see the whole command line, no matter how long.
– JohnD
Feb 21 '18 at 2:43
|
show 6 more comments
PowerShell to the rescue.
Find:
Get-WmiObject Win32_Process -Filter "name = 'perl.exe'" | where {$_.CommandLine -eq '"C:strawberryperlbinperl.exe" t/Server_PreFork.t'}
And kill as bonus:
Get-WmiObject Win32_Process -Filter "name = 'perl.exe'" | where {$_.CommandLine -eq '"C:strawberryperlbinperl.exe" t/Server_PreFork.t'} | ForEach-Object { Invoke-WmiMethod -Path $_.__Path –Name Terminate }
You can run it from powershell directly or from a ps1 if you've got your system setup. I detail unrestricted script setup on i kill zombies with powershell as well as other powershell tricks...
1
Whoa... the kill part is quite dangerous, given the title of the question ;) Otheriwse a very neat answer ;)
– Tom
Aug 23 '17 at 14:14
add a comment |
PowerShell to the rescue.
Find:
Get-WmiObject Win32_Process -Filter "name = 'perl.exe'" | where {$_.CommandLine -eq '"C:strawberryperlbinperl.exe" t/Server_PreFork.t'}
And kill as bonus:
Get-WmiObject Win32_Process -Filter "name = 'perl.exe'" | where {$_.CommandLine -eq '"C:strawberryperlbinperl.exe" t/Server_PreFork.t'} | ForEach-Object { Invoke-WmiMethod -Path $_.__Path –Name Terminate }
You can run it from powershell directly or from a ps1 if you've got your system setup. I detail unrestricted script setup on i kill zombies with powershell as well as other powershell tricks...
1
Whoa... the kill part is quite dangerous, given the title of the question ;) Otheriwse a very neat answer ;)
– Tom
Aug 23 '17 at 14:14
add a comment |
PowerShell to the rescue.
Find:
Get-WmiObject Win32_Process -Filter "name = 'perl.exe'" | where {$_.CommandLine -eq '"C:strawberryperlbinperl.exe" t/Server_PreFork.t'}
And kill as bonus:
Get-WmiObject Win32_Process -Filter "name = 'perl.exe'" | where {$_.CommandLine -eq '"C:strawberryperlbinperl.exe" t/Server_PreFork.t'} | ForEach-Object { Invoke-WmiMethod -Path $_.__Path –Name Terminate }
You can run it from powershell directly or from a ps1 if you've got your system setup. I detail unrestricted script setup on i kill zombies with powershell as well as other powershell tricks...
PowerShell to the rescue.
Find:
Get-WmiObject Win32_Process -Filter "name = 'perl.exe'" | where {$_.CommandLine -eq '"C:strawberryperlbinperl.exe" t/Server_PreFork.t'}
And kill as bonus:
Get-WmiObject Win32_Process -Filter "name = 'perl.exe'" | where {$_.CommandLine -eq '"C:strawberryperlbinperl.exe" t/Server_PreFork.t'} | ForEach-Object { Invoke-WmiMethod -Path $_.__Path –Name Terminate }
You can run it from powershell directly or from a ps1 if you've got your system setup. I detail unrestricted script setup on i kill zombies with powershell as well as other powershell tricks...
edited yesterday
mwfearnley
5,01731724
5,01731724
answered Aug 7 '14 at 5:46
Dave HornerDave Horner
18316
18316
1
Whoa... the kill part is quite dangerous, given the title of the question ;) Otheriwse a very neat answer ;)
– Tom
Aug 23 '17 at 14:14
add a comment |
1
Whoa... the kill part is quite dangerous, given the title of the question ;) Otheriwse a very neat answer ;)
– Tom
Aug 23 '17 at 14:14
1
1
Whoa... the kill part is quite dangerous, given the title of the question ;) Otheriwse a very neat answer ;)
– Tom
Aug 23 '17 at 14:14
Whoa... the kill part is quite dangerous, given the title of the question ;) Otheriwse a very neat answer ;)
– Tom
Aug 23 '17 at 14:14
add a comment |
Previous answers are great in case the process is already running and is not going to terminate any soon. However If you need (as I did) to do this perhaps with processses start up multiple times and/or quickly terminate, or perhaps log occurences in a longer period of time, there is a way to this using Process Monitor.
Basically it logs various events in the system, in this case we can just filter the "Process Start" event and the name of the process we want to monitor, as shown below:
Then just keep the process monitor running and do whatever you do to get the process you want to log running. You can see in either the "Detail" column or the "Command line" column (depends on how you configure those) the command line arguments. For example:
Of course this way you can extract much more related information such as what is the working directory, what environment variables have been passed on the process, etc... Also it is easy to export the results into a file.
add a comment |
Previous answers are great in case the process is already running and is not going to terminate any soon. However If you need (as I did) to do this perhaps with processses start up multiple times and/or quickly terminate, or perhaps log occurences in a longer period of time, there is a way to this using Process Monitor.
Basically it logs various events in the system, in this case we can just filter the "Process Start" event and the name of the process we want to monitor, as shown below:
Then just keep the process monitor running and do whatever you do to get the process you want to log running. You can see in either the "Detail" column or the "Command line" column (depends on how you configure those) the command line arguments. For example:
Of course this way you can extract much more related information such as what is the working directory, what environment variables have been passed on the process, etc... Also it is easy to export the results into a file.
add a comment |
Previous answers are great in case the process is already running and is not going to terminate any soon. However If you need (as I did) to do this perhaps with processses start up multiple times and/or quickly terminate, or perhaps log occurences in a longer period of time, there is a way to this using Process Monitor.
Basically it logs various events in the system, in this case we can just filter the "Process Start" event and the name of the process we want to monitor, as shown below:
Then just keep the process monitor running and do whatever you do to get the process you want to log running. You can see in either the "Detail" column or the "Command line" column (depends on how you configure those) the command line arguments. For example:
Of course this way you can extract much more related information such as what is the working directory, what environment variables have been passed on the process, etc... Also it is easy to export the results into a file.
Previous answers are great in case the process is already running and is not going to terminate any soon. However If you need (as I did) to do this perhaps with processses start up multiple times and/or quickly terminate, or perhaps log occurences in a longer period of time, there is a way to this using Process Monitor.
Basically it logs various events in the system, in this case we can just filter the "Process Start" event and the name of the process we want to monitor, as shown below:
Then just keep the process monitor running and do whatever you do to get the process you want to log running. You can see in either the "Detail" column or the "Command line" column (depends on how you configure those) the command line arguments. For example:
Of course this way you can extract much more related information such as what is the working directory, what environment variables have been passed on the process, etc... Also it is easy to export the results into a file.
edited Jan 27 '18 at 10:53
answered Jan 27 '18 at 10:39
SilSil
1312
1312
add a comment |
add a comment |
When using CygWin, if I start a Python process, this is an example of command line:
c:CygWinbinpython2.7.exe /usr/local/bin/sudoserver.py
But Process Explorer only sees the main exe:
(note the "path: [Error opening process message]" (see EDIT-1)).
Same results for tasklist
:
C:>tasklist | find "python" /i
python2.7.exe 5740 Console 1 15.312 KB
So, the only trick I know until now, is finding it via CygWin Bash shell pgrep
:
Luis@Kenobi /cygdrive/c/
$ pgrep -f -l server.py
5740 /usr/bin/python2.7 /usr/local/bin/sudoserver.py
It is useful to know this, as long as CygWin cohabits with no problems in Windows, and you can use it to run many POSIX and Python programs.
EDIT: In Windows you don't seem to need administrator priviledges for tasklist. In CygWin you will need them to be able to view an administrator's process (what seems more logical to me: the full command-line could have some parameters like passwords inside), so we must run the CygWin Bash in elevated Administrator Mode.
EDIT-1: This problem will not happen if you run Process Explorer as administrator. Thanks you for pointing, @Pacerier.
2
If you run as administrator you wouldn't be seeing[Error opening process message]
– Pacerier
Jan 20 '15 at 3:20
You were right, @Pacerier . Too obvious to remember :-) . Thanks you. I have edited my post to reflect it.
– Sopalajo de Arrierez
Jan 20 '15 at 3:30
add a comment |
When using CygWin, if I start a Python process, this is an example of command line:
c:CygWinbinpython2.7.exe /usr/local/bin/sudoserver.py
But Process Explorer only sees the main exe:
(note the "path: [Error opening process message]" (see EDIT-1)).
Same results for tasklist
:
C:>tasklist | find "python" /i
python2.7.exe 5740 Console 1 15.312 KB
So, the only trick I know until now, is finding it via CygWin Bash shell pgrep
:
Luis@Kenobi /cygdrive/c/
$ pgrep -f -l server.py
5740 /usr/bin/python2.7 /usr/local/bin/sudoserver.py
It is useful to know this, as long as CygWin cohabits with no problems in Windows, and you can use it to run many POSIX and Python programs.
EDIT: In Windows you don't seem to need administrator priviledges for tasklist. In CygWin you will need them to be able to view an administrator's process (what seems more logical to me: the full command-line could have some parameters like passwords inside), so we must run the CygWin Bash in elevated Administrator Mode.
EDIT-1: This problem will not happen if you run Process Explorer as administrator. Thanks you for pointing, @Pacerier.
2
If you run as administrator you wouldn't be seeing[Error opening process message]
– Pacerier
Jan 20 '15 at 3:20
You were right, @Pacerier . Too obvious to remember :-) . Thanks you. I have edited my post to reflect it.
– Sopalajo de Arrierez
Jan 20 '15 at 3:30
add a comment |
When using CygWin, if I start a Python process, this is an example of command line:
c:CygWinbinpython2.7.exe /usr/local/bin/sudoserver.py
But Process Explorer only sees the main exe:
(note the "path: [Error opening process message]" (see EDIT-1)).
Same results for tasklist
:
C:>tasklist | find "python" /i
python2.7.exe 5740 Console 1 15.312 KB
So, the only trick I know until now, is finding it via CygWin Bash shell pgrep
:
Luis@Kenobi /cygdrive/c/
$ pgrep -f -l server.py
5740 /usr/bin/python2.7 /usr/local/bin/sudoserver.py
It is useful to know this, as long as CygWin cohabits with no problems in Windows, and you can use it to run many POSIX and Python programs.
EDIT: In Windows you don't seem to need administrator priviledges for tasklist. In CygWin you will need them to be able to view an administrator's process (what seems more logical to me: the full command-line could have some parameters like passwords inside), so we must run the CygWin Bash in elevated Administrator Mode.
EDIT-1: This problem will not happen if you run Process Explorer as administrator. Thanks you for pointing, @Pacerier.
When using CygWin, if I start a Python process, this is an example of command line:
c:CygWinbinpython2.7.exe /usr/local/bin/sudoserver.py
But Process Explorer only sees the main exe:
(note the "path: [Error opening process message]" (see EDIT-1)).
Same results for tasklist
:
C:>tasklist | find "python" /i
python2.7.exe 5740 Console 1 15.312 KB
So, the only trick I know until now, is finding it via CygWin Bash shell pgrep
:
Luis@Kenobi /cygdrive/c/
$ pgrep -f -l server.py
5740 /usr/bin/python2.7 /usr/local/bin/sudoserver.py
It is useful to know this, as long as CygWin cohabits with no problems in Windows, and you can use it to run many POSIX and Python programs.
EDIT: In Windows you don't seem to need administrator priviledges for tasklist. In CygWin you will need them to be able to view an administrator's process (what seems more logical to me: the full command-line could have some parameters like passwords inside), so we must run the CygWin Bash in elevated Administrator Mode.
EDIT-1: This problem will not happen if you run Process Explorer as administrator. Thanks you for pointing, @Pacerier.
edited Mar 20 '17 at 10:17
Community♦
1
1
answered Apr 7 '14 at 15:07
Sopalajo de ArrierezSopalajo de Arrierez
4,01494080
4,01494080
2
If you run as administrator you wouldn't be seeing[Error opening process message]
– Pacerier
Jan 20 '15 at 3:20
You were right, @Pacerier . Too obvious to remember :-) . Thanks you. I have edited my post to reflect it.
– Sopalajo de Arrierez
Jan 20 '15 at 3:30
add a comment |
2
If you run as administrator you wouldn't be seeing[Error opening process message]
– Pacerier
Jan 20 '15 at 3:20
You were right, @Pacerier . Too obvious to remember :-) . Thanks you. I have edited my post to reflect it.
– Sopalajo de Arrierez
Jan 20 '15 at 3:30
2
2
If you run as administrator you wouldn't be seeing
[Error opening process message]
– Pacerier
Jan 20 '15 at 3:20
If you run as administrator you wouldn't be seeing
[Error opening process message]
– Pacerier
Jan 20 '15 at 3:20
You were right, @Pacerier . Too obvious to remember :-) . Thanks you. I have edited my post to reflect it.
– Sopalajo de Arrierez
Jan 20 '15 at 3:30
You were right, @Pacerier . Too obvious to remember :-) . Thanks you. I have edited my post to reflect it.
– Sopalajo de Arrierez
Jan 20 '15 at 3:30
add a comment |
go to run
or goto start
and search:
tasklist -m
tasklist -svc
5
That does not show the calling command line./m
shows loaded modules (DLLs, etc.) and/svc
shows services hosted in each process.
– Bob
Nov 2 '12 at 5:02
add a comment |
go to run
or goto start
and search:
tasklist -m
tasklist -svc
5
That does not show the calling command line./m
shows loaded modules (DLLs, etc.) and/svc
shows services hosted in each process.
– Bob
Nov 2 '12 at 5:02
add a comment |
go to run
or goto start
and search:
tasklist -m
tasklist -svc
go to run
or goto start
and search:
tasklist -m
tasklist -svc
answered Nov 2 '12 at 4:46
ZanardanZanardan
31
31
5
That does not show the calling command line./m
shows loaded modules (DLLs, etc.) and/svc
shows services hosted in each process.
– Bob
Nov 2 '12 at 5:02
add a comment |
5
That does not show the calling command line./m
shows loaded modules (DLLs, etc.) and/svc
shows services hosted in each process.
– Bob
Nov 2 '12 at 5:02
5
5
That does not show the calling command line.
/m
shows loaded modules (DLLs, etc.) and /svc
shows services hosted in each process.– Bob
Nov 2 '12 at 5:02
That does not show the calling command line.
/m
shows loaded modules (DLLs, etc.) and /svc
shows services hosted in each process.– Bob
Nov 2 '12 at 5:02
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f415360%2fhow-do-i-find-out-command-line-arguments-of-a-running-program%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown