windows: command line used to launch a program - windows

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

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)

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.

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.

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

Related

Editing Default Commands on Windows Command Prompt

I am creating a Windows virtual machine and would like to edit the default commands for the command prompt like tree so that when that command is typed it will do what I want it to do. I found 'tree.com' in System32, but when I open it, it is gibberish. How might I be able to read and edit it?
Modifying basic Windows programs is not a good idea (in case you need them there not there anymore), but there's another approaches: doskey, based on UNIX aliases: this allows you to, when you enter tree, to start up another program instead. Help can be found under doskey /? and there are plenty of examples online.
Files with extension .com are compiled executables. There is nothing to edit in there.

How to know how my exe run?

There is 2 ways that I can run exe file: with double click or via command line.
I want to do different function from each way..
Is it possible?
Thanks!
You could also start via a Process, Schedule, register an extension, Autostart any many more. You need to tell us what you want to achieve for a satisfying answer. Following Answer is for switch a command-line and a gui mode.
If you have the Install of you Program in you hands, you can simply use "Command" to read the commandline arguments and use that for a command line mode and a gui mode.
Make a switch like "-gui" and simply write
If Command = "-gui" Then
frmMain.Show
End If

Windows App Store execute simply cmd command

I need execute simply command in cmd.exe, for example:
ls -l
I care to read the result of executing this command, but I know I didn't Process library. Could you help me?
You can use so called "brokered components" to achieve this. This worked for Windows 8.1, I'm not 100% sure but think it still works for W10.
It's a little hacky. The reason is that it requires extra steps to get along with the security restrictions in Windows and therefore you need some additional projects and stuff
Here's a link to a blogpost on this:https://blogs.msdn.microsoft.com/mim/2014/06/24/create-a-winrt-brokered-component-feedback-from-a-real-life-developement/ You will find more details if you search for "brokered components".
You can see it in action in a video I recorded for YouTube some month ago: https://www.youtube.com/watch?v=3yiZBG6PQmY

Is it possible to determine what command line arguments were passed to a Windows executable?

In a unix environment, often one can just run ps and see the exact command as it was invoked, including switches and any parameter values that it may have received.
I have a Windows executable that it would be valuable for debugging purposes if I could see just what values were passed in, after it is already running. Can this be done, either with the utilities already present in a Windows default install, or something that I could download?
On Windows 7 and newer (possibly Vista, but I don't have an install to check), the built-in Task Manager can do this. Go to the Processes tab, then View->Select Columns->Command Line.
Sysinternals has a handy tool, process explorer. One of the column you can show for each process is the commandline.
Sysinternals is provided free from microsoft
link
You can see this from Windows Task Manager, just a few clicks.
Right click on taskbar or Ctrl-Alt-Del to open task manager.
From the menu View > Select columns > Check Command Line
you can check command line using Task Manager :

.bat Set FontSize - Windows Command Line

Intro:
I swear have searched around for sometime before posting, but have been unable to find an answer for this..
Question:
Regarding Windows Command Line:
is there some way to set the font/text-size via an actual windows command line in a .bat file?
-Not through going to Properties -> etc. (I understand that quite sufficiently :P)
--Plz no PowerShell.
Additional Notes:
Reason: Thinking of business system based Command Line front-end, PHP back-end.
Thanks in advance.
Without using PowerShell, the only way I can think of would be to modify the registry values under HKCU\Console. See the relevant Technet documentation. However, changes made to the registry values will not update already running console windows. You won't see your changes until you spawn a new console.
As far as how to make changes to the registry, reg /help for more info.

Resources