Tag Info

Hot answers tagged

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 ...


46

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 ...


39

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 ...


28

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 ...


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.


16

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:


14

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


14

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] ...


11

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

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 ...


10

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. ...


10

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


9

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.


9

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

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

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 ...


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

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


7

GUI method with correct icon Go to chrome://settings/ (or Menu > Settings) Scroll down to Users section Select the currently active profile user & click the Edit button Click Add desktop shortcut To repeat the process for other profiles, first switch to that profile & repeat 1-4 This creates a shortcut icon to your profile with the correct ...


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 ...


6

It means the tool should stop treating the dash as an option character. For example, suppose you want to search for a dash character in a file: grep -- - file In your example the -- is necessary because the gem tool is calling another tool, which also uses dash-prefixed options.


6

You need to quote when it otherwise would be interpreted differently from what you might intent by the shell. A few examples: You'd quote the string argument foo bar to prevent a program to interpret it as two arguments due to the space. # results in two directories, 'foo' and 'bar'. mkdir foo bar # results in one directory named 'foo bar' mkdir "foo ...


6

The following works on Windows 7. It may work on others. Folder Options has three tabs. You can choose which tab is selected when it is opened: General Tab - C:\Windows\System32\rundll32.exe shell32.dll,Options_RunDLL 0 View Tab - C:\Windows\System32\rundll32.exe shell32.dll,Options_RunDLL 7 Search Tab - C:\Windows\System32\rundll32.exe ...


5

Process Explorer can show you command line params of current processes. Process Monitor can log all activities, including process creations. To see just them, add a filter "Operation is Process Create".


5

A common question in Unix. The main way is to give the full path name to the file, so it doesn't have a dash in front of it: $ rm -file.txt unknown option -l $ rm ./-file.txt #No problem! $ rm $PWD/-file.txt #Same thing Some commands, you can use a dash by itself (or a double dash) to end the options. However, this is not necessarily true with all ...


5

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 ...


5

What happens is that cat treats --no-recursion as its option. You can do either of the following: cat ./--no-recursion OR cat -- --no-recursion Can do the same thing with rm to delete this file (since it's probably an error of some kind). In my first example, I prepended current directory path ("./") to the file name, so it does not start with an ...


4

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 ...


4

I came up with my own solution, but it's a bit too complicated to post here. If anyone is interested, please comment on this answer, and I will find somewhere to post it. Edit: Here is my solution, as requested. Now, set up some functions for appending to the built-in argument lists stored in tramp-methods: (defun tramp-get-method-parameter (method ...



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