command-line-arguments interview questions
Top command-line-arguments frequently asked interview questions
I know that unix has man pages, but is there a place I can look to discover command-line arguments of programs? Going to command prompt and typing notepad /?
doesn't give anything.
Source: (StackOverflow)
When typing cd..
without a space between cd
and ..
the Windows command prompt will happily switch to the parent folder. Is there an explanation for this behaviour? The command does not follow the standard format of command<space>arguments

Also, why does this not create consistent results?

Source: (StackOverflow)
How can I add command line options to an executable in a shortcut in Windows XP?
For example in the shortcut properties in target I have:
"c:\path\to\exe\pogram.exe"
I want to add some options:
"c:\path\to\exe\program.exe -option1 -option2"
However when I do this I get an error saying that the name specified in the target box is not valid.
Source: (StackOverflow)
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).
Source: (StackOverflow)
In bash, you can use !*
to get all the arguments from the previous command. As an example, if you did cp /some/path /some/other/path
and then did mv !*
, the second command would be expanded to mv /some/path /some/other/path
.
Is there anything like this that can be used to access a specific argument from a command instead of all of them?
Source: (StackOverflow)
Most unixoid commands feature short and long alternatives for command line options, like ls -a
and ls --all
, or ls -A
and ls --almost-all
. Why do those two ways exist? One is shorter to type, the other is easier to read and understand. But every time I write a shell script, I need to decide which I want to use. Is it known why the two alternatives exist? Which one was first, why was the other introduced. On DOS/Windows for example there's almost only case-insensitive one-letter options.
Source: (StackOverflow)
I need to convert videos but I don't know where are they, so I need to find
them. How can I give the result and an output file name to ffmpeg with xargs ?
I already find out that I can construct the two parameter with the command
find . -iname "*.mov" -printf "%p %f\n"
I can't find anything related in the xargs
manual.
I want something like this:
find . -iname "*.mov" -printf "%p %f\n" | xargs ffmpeg -i {param1} -f flv {param2}
How can I do this ?
Source: (StackOverflow)
I use the new built-in "Users" feature of Chrome to switch between Home/Work accounts easily. However, Chrome remembers the "last" user profile you had selected when launching new windows. This is a problem if I close down my "Home" profile last, because when I then click the Email shortcut on my taskbar, because it goes to mail.mycompany.com using my Home profile, and I'm not logged in.
I'd like to change the shortcut to the company webmail to pass a switch that tells Chrome to always start as the "Default" user, regardless of the last one used.
Note: I have tried user-data-dir, and this seems to do something very different, completely isolated from the Users functionality built in to Chrome. It's possible I'm using it wrong, but please test this before assuming it does the same thing and posting an answer ;-)
Source: (StackOverflow)
I was wondering how to make a file named as a flag, e.g., if I wanted to make a folder named -a
, what commands would do the trick?
I tried mkdir '-a'
, mkdir \-a
, and neither worked. I'm on Ubuntu.
Source: (StackOverflow)
If I need to open the Control Panel through the command prompt, it is enough to type
control
I need to open the Folder Options window through typing some command through the command prompt.
Any ideas how?
Source: (StackOverflow)
I've been digging in this for a while, but I could not understand how this works. What I need is:
- Be able to run a batch file
- The batch file should have parameters
- The parameters should be passed from the batch file to the PowerShell script that is in the same file
Why I need this? Because I need to run a simple batch file to do some stuff, but I need advanced functionality that works only from PowerShell. Specifically: I need a SaveFileDialog
for some application.
The following is what I have right now, where I stripped the complicated parts of SaveFileDialog
, and left a simple batch + powershell part:
<# :
@echo off
setlocal
powershell -noprofile "iex (${%~f0} | out-string)"
goto :EOF
#>
Write-Host "Hello, I'm PowerShell!"
If I put all this in a batch file, say, myfile.bat
. It runs and calls PowerShell and writes that message.
My question/request: How can I run myfile.bat param1 param2 param3
, and get these arguments/parameters be passed to my PowerShell script? I'd really appreciate a minimal example that just prints the parameters through powershell's write-host
.
Please feel free to ask for any more details. Thank you!
Source: (StackOverflow)
If you type mailx
at the command line when you have new mail, it nicely shows you headers of your new mail and leaves you at a ? prompt where you can do mail commands. But if you don't have new mail and you try to get into mailx, it just says "no new mail" and kicks you out. I want to get into mailx when I don't have new mail and also what I haven't figured out to do is once I'm in at the ? prompt, I want to see a list of all the headers of the already read mail still in my mailbox.
So the two things I would like to know are how to get to the ? prompt without mailing myself a dummy email, and once I'm in, how to see a list of the already read messages in my inbox.
Source: (StackOverflow)
So I noticed when I press Ctrl+Alt+Del and click Task-Manager, Windows calls taskmgr.exe /3
as command. Several websites claim the Task Manager has no command line arguments.

Why does Windows attaches this argument?
Source: (StackOverflow)