Hot answers tagged

99

As some of the other answers/comments note, the idea that there must be a space after the command is not correct. A well-known example is that you can type a forward slash after a command, without needing a space first. However, there is another behavior which is a bit less understood, and allows the "cd.." that you are asking about. This behavior also ...


90

The command line argument you're looking for is --profile-directory=Default. Here's the complete command line for Mac OS X: open -a "Google Chrome" --args --profile-directory=Default And for Linux: google-chrome --profile-directory=Default It expects the internal names of the profiles: My second profile, named "Lemonade" by Chrome, would be --profile-...


72

You have basically two options: Option 1: Use Automator to create an application that in effect launches Chrome with command line arguments. Start Automator and select to create an Application. Double-click Run Shell Script in the Library/Utilities folder and replace the text content — cat — with the following: open -a "Google Chrome.app" --args -pinned-...


61

Have you tried "c:\path\to\exe\program.exe" -option1 -option2 Only the program path and name need to be enclosed in quotes.


48

Call the command like so: mkdir -- -a The -- means that the options end after that, so the -a gets interpreted literally and not as an option to mkdir. You will find this syntax not only in mkdir, but any POSIX-compliant utility except for echo and test. From the specification: The argument -- should be accepted as a delimiter indicating the end of ...


41

You assume that a command name and its arguments must be separated by a space, specifically, but this is not true. As long as the invocation can be unambiguously interpreted, the invocation is valid. In this case, the first argument begins with . and . cannot be part of the command name, so cd and .. are simply parsed as two separate tokens. Usually, your ...


35

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


34

In !*, ! is the history expansion prefix, and * is the word designator that means all arguments. You can memorize the general syntax as bang-line-colon-column (!line:column). There are many possible shortcuts: the default line is the previous line, the default column specifier is “all”, and you can leave off the colon if the column specifier is non-numeric (...


33

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:


30

GUI method with proper icon (for Windows) Type chrome://settings/ in address bar (or Menu > Settings) Scroll down to Users section Select the user marked (current) & click Edit button Now click Add desktop shortcut Optional Switch to any other profile & repeat steps 1-4 This creates a shortcut icon to your profile with the correct picture in ...


27

start /b "" "c:\Program Files\Oracle\VirtualBox\VBoxHeadless.exe" -startvm "debian604 64" If you read the parameter list with start /?: START ["title"] [/D path] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED] [/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL] [/NODE <NUMA node>] [/AFFINITY <hex affinity mask>] [/WAIT] [/B]...


20

The simplest way that should work with any reasonable program is to use a relative path name in front of the -, e.g. mkdir ./-a will create a directory called -a in the current working directory. The most common example of using this "trick" is when you want to remove a file which begins with a dash, so you can do rm ./-a.


19

The cd..command is correct and it was defined like that in the original command interpreter command.com which later was named cmd.exe. The command interpreter knows how to process cd.., because . is a special character, just like \.


16

If I understand what you are looking for try dir/s/b *.bat If that works then redirect it into a text file.... dir/s/b *.bat > textfile.txt You may also find it useful to have a list of command line switches for the DIR command.


14

Is this what you are looking for? RUNAS Execute a program under a different user account. Syntax RUNAS [/profile] [/env] [/netonly] /user:user Program Key /profile Option to load the user's profile (registry) /env Use current environment instead of user's. /netonly Use the credentials specified only for remote connections. /...


14

Originally there were only single-character options. Some programs took multiple-character options, but still with a single dash. AFAIK double-dash multiple-character options come from GNU; they were introduced because they are more readable and often more memorable (and you can have more than 52 of them). Many programs now have both: short options for when ...


12

Place the switches after the quotes. Only the program path is kept in quotes due to spaces in the path. Something like My Documents will not resolve properly due to the space between the words, so quotes are needed. This is also why you probably won't find a program with multi-word switches (that are seperate) such as --example switch. You will usually see ...


12

When they're not quoted, there is no difference between $@ and $*. Both are equal to $1 $2 … But don't do this. With double quotes, "$@" expands each element as an argument: "$1" "$2" … while "$*" expands to all elements merged into one argument: "$1c$2c..." where c is the first character of IFS. If you unset IFS, c will be a space. You ...


11

To remove a file named -x, use rm -- -x (-- means end of options) or rm ./-x.


11

It's a backwards compatibility hack. The command line interpreter is designed to be backwards compatible with commands from the original MSDOS command interpreter, which was designed to be backwards compatible with the CP/M command interpreter. Neither CP/M nor MSDOS allowed a . in a filename (it was interpreted as a separator between two parts of the ...


10

I think you want 'Process Substitution' http://tldp.org/LDP/abs/html/process-sub.html. It also works on zsh, though it has more options and the syntax may be different. It creates a pseudo file (/dev/fd/something) for each substitution. It's pretty useful. The command can only read as a stream, meaning it can not go back and forth with fseek. It needs to ...


9

You could write a script that launches Chrome, but that wouldn't be the application icon in the dock, and it would cause a separate Chrome icon to appear. So you'll have to create an application package. First, make a copy of your Chrome app. Then, there are two approaches that might work; I'm not sure which will play better with Mac OS X and/or Chrome's ...


9

It is fairly common to ask this type of question in interview settings. A common way to handle files with dashes is either: $ rm -- -f $ rm ./-f


9

batch, unfortunately, doesn't have a builtin getops function like bash does. However, you could implement your own poor-man's variant: :GETOPTS if /I %~1 == --age set AGE=%2& shift if /I %~1 == --gender set GENDER=%2& shift shift if not (%1)==() goto GETOPTS


8

The reason people use xargs in combination with find is that multiple file names will be passed to the same program invocation of whatever program xargs launches. For example, if find returns the files foo, bar, and baz, the following will run mv only once: find sourceDir [...] -print0 | xargs -0 mv -t destDir Effectively, it calls mv like the following: ...


8

Another, albeit less convenient method of choosing which profile will launch is to edit the Local State file in the Chrome User Data directory and search for "last_used": if you change the value it lists to a different Profile that's the one that will open the next time you launch chrome normally (unless of course you're using the switch mentioned above). I ...


8

Can you do it with Powershell? or does it need to be batch? Powershell makes it nice and easy, you just need to add something like this at the top of your script, and then you can call each parameter in any order param ( [string]$Age, [string]$Gender ) You can do it with batch, but it will require lots of parameter checking.. Here's a few links of some ...


7

The (deprecated) MSTSC /console switch is now called the /admin switch: In both Vista SP1 and Windows Server 2008, the Remote Desktop Program has been updated to version 6.1 (6.0.6001) and one of the changes is that the functionality previously associated with the /console switch is now called the /admin switch. By using it you're connecting to the ...


7

Run a normal process listing through Terminal: ps auxww The ww options are BSD syntax for a wide listing. You can also use: ps -ef for the now commonly used POSIX syntax. Example output, where you can see the arguments of various processes: USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND werner 22208 3.8 0.1 ...



Only top voted, non community-wiki answers of a minimum length are eligible