Questions tagged [command-line]

An interface for interacting with a computer using typed commands in a text-oriented environment, as opposed to a graphical user interface (GUI).

Questions that should have this tag

  • Scripting questions
  • BASH or Windows command line commands
  • PowerShell items

Basic Syntax

  • { option1 | option2 } - Choose one or the other
  • [ option ] - Optional
  • COMMAND -The command itself
  • parameter - Parameters that are required to complete the command

Extra Information

  • Commands for questions should have a backtick (`, to the left of the 1 on most keyboards) before and after any commands to help with realizing where the commands are
    • Example: How do I use the DIR command?
  • Whenever possible, because of how extensive and powerful the CLI can be, if there are long commands or scripts, either use the <pre></pre> tag before and after the script, or indent each line with 4 spaces. Example below:
@echo off
echo Hello World!
  • When answering questions, if at all possible, show where other users can replace different variables for their own use
    • Example: Replace the name with the username you are trying to use:
      NET USER JohnSmith
13002 questions
46
votes
2 answers

CMD: *.* or just *?

Back in the 1990s, I would use "*.*" to represent any filename in MS-DOS, but I've seen more scripts using just "*" these days. Does it actually make any difference which one I use?
Foebane
  • 809
  • 1
  • 9
  • 16
32
votes
3 answers

Find a Directory/Folder with CMD without knowing full path

I don't know the full path to a folder, just the folder name. I would like to find everywhere where this folder is using CMD. Is there a command that does this? I am looking for an equivalent to *nix's: find . -name -type d Is there…
29
votes
9 answers

How To Execute Cmd.exe Silently?

I use below code in Run dialog of Windows XP. cmd /c "C://Program Files/Adobe/Adobe Photoshop CS4/Photoshop.exe" You may replace the program path any program installed on your system. The problem is Photoshop launches up but cmd.exe window still…
Valentina Tatya
25
votes
7 answers

Killing all instance of a specific program from the command line

Is there any way of killing all instances of a specific program with a command-line command?
George
  • 259
24
votes
1 answer

What is the equivalent of `ss` for Mac?

I want a command-line tool to inspect sockets, like ss for Linux, but for Mac. Is there a port of that tool, or another tool I could use for Mac OS systems?
17
votes
4 answers

How to paste to cmd.exe without a mouse?

Possible Duplicate: How do I paste into the Windows CMD prompt by using only the keyboard? The usual way to paste text in a cmd.exe shell is to right-click. How can you paste text using only the keyboard?
12
votes
4 answers

Open a directory in a Linux GUI file browser via the command line

Is there a way to open a file browser window (in KDE or GNOME or some desktop environment) for a directory while your navigating directories from the terminal? Text editors that have a GUI will open up when I run them via the command line; I just…
Matthew
11
votes
1 answer

How can I feed a file into a program that reads stdin (on Windows command line)?

I have a program P that processes stdin. How can I feed a file into this program from the Windows command line? P < filename does not work. filename | P filename > P does not work either. edit tried again, in fact P < filename or grep abc <…
joh
  • 563
10
votes
2 answers

Passing Log in Credentials with Pushd? other command?

My Scenario: I am running the pushd command to run searches on remote domain computers. However the search performs very slow/or not at all when a user is not logged on to the machine(machine is still powered on.) I was wondering if it is possible…
sealz
  • 2,304
9
votes
2 answers

Delete multiple files in one command

On the Linux command line, I want to delete 3 files in one command, how would I do it? For instance, I want to delete: public_html.tar.gz dbapp.sql dbwp.sql
9
votes
4 answers

Why am I able to execute a program that is not in my PATH environment variable?

I was wondering why the command java -version is globally accessible? I could run it from any directory and its working: How does it work? This is what my system PATH variable looks like: C:\Program Files (x86)\NVIDIA…
Pacerier
  • 27,223
9
votes
2 answers

When running bat files, how to show commands but not "rem"ed out lines?

When running a bat file, I'd like to see the commands being executed but not anything rem'ed out. The problem is that it seems to be all or nothing. When using "echo off" nothing shows except the results of the commands, like "2 files copied". …
CChriss
  • 1,323
8
votes
3 answers

How do I view a list of devices from the command line in Windows

I want to use the Windows command line to enumerate through devices connected to a computer and return information. How can I accomplish this?
JMK
  • 3,310
8
votes
4 answers

cmd.exe: "del *.txt" also removes *.txt1 etc

Possible Duplicate: WinXP dir command: 3 and 4 char extensions are the same? I have been annoyed by a strange behavior of cmd.exe for a long time (at least WinXP and Windows7). A command like del *.txt will also remove *.txt1 files (any number of…
keV
  • 81
7
votes
2 answers

How does && work within a batch/cmd script?

(I am using Win10 20H2) I know if you have command A && command B, then command B only executes if command A was "completed successfully", but how exactly is it decided whether command A was successful or not? My first thought was that it must be…
TechHorse
  • 347
1
2 3
13 14