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).
1,533
questions
188
votes
20
answers
771k
views
Run a batch file in a completely hidden way
I'm looking for some way to run a batch file (.bat) without anything visible to the user (no window, no taskbar name, .etc..).
I don't want to use some program to do that, I'm looking for something ...
140
votes
25
answers
389k
views
How can I mass rename files?
I've got a bunch of files named with a the pattern 99 - DescriptiveName.txt and I'd like to remove the number from the front so I just have DescriptiveName.txt.
How can I do this? Can I do it from ...
509
votes
19
answers
876k
views
Is there any 'sudo' command for Windows?
I always work on a non-administrator account on my Windows computer. Sometimes I need to install programs which requires administrator access. As I mostly use the Windows command prompt, is there a ...
104
votes
7
answers
205k
views
How does the Windows RENAME command interpret wildcards?
How does the Windows RENAME (REN) command interpret wildcards?
The built in HELP facility is of no help - it doesn't address wildcards at all.
The Microsoft technet XP online help isn't much better. ...
192
votes
13
answers
725k
views
How can I put the computer to sleep from Command Prompt/Run menu?
I know that almost everything on Windows, like opening any sort of application, can be done from the command prompt or from the Run menu.
How can I put my computer to sleep or shut it down? What is ...
14
votes
6
answers
41k
views
Are the Command Prompt and MS-DOS the same thing?
I argued with my friend that the Command Prompt is just a GUI version of MS-DOS which works in the Windows forms environment. He totally disagrees with me.
Who is right?
302
votes
9
answers
1.3m
views
Using cd command in Windows command line, can't navigate to D:\
This may be a silly question, and I think I have looked elsewhere to find the answer... Might be a path issue, but when I open the command line and type from the C:\>:
cd D:\
I cannot get to the ...
5
votes
1
answer
6k
views
Parameter expansion (variable expansion) and quotes within quotes
While working in a (Unix) shell, sometimes I need to double-quote single-quotes or vice versa, i.e. to write something like "foo 'bar baz' moo" or 'foo "bar baz" moo'. This may be because
the ...
18
votes
6
answers
104k
views
How to access the Administrator Command Prompt in Windows 8?
When I access the Run dialog in Windows 8 and type cmd, it opens a command prompt but it doesn't have administrative privileges.
Looking for cmd at the default start screen does show a command prompt ...
36
votes
4
answers
53k
views
Assign a shortcut to running a script in OS X
Does OS X provide an easy way to bind key combinations to commands which are typically run on the command line?
For example, is there some way to assign ⌘ Cmd+L as a global shortcut to quickly lock ...
128
votes
8
answers
68k
views
Forward SSH traffic through a middle machine
SSH tunneling is very confusing to me. I am wondering if I can do this in Linux.
I have 3 machines..
A. My local machine at home.
B. Machine at work that I can SSH into (middle man).
C. My desktop ...
105
votes
6
answers
349k
views
Turn off display in Windows on command
Is there a way to turn off the display in Windows (7), preferably without using additional software?
Powershell script works fine, but leaves command-line window after turning on the display.
259
votes
12
answers
392k
views
How do I start Chrome using a specified "user profile"?
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 ...
599
votes
9
answers
832k
views
Using ffmpeg to cut up video
I am using ffmpeg to cut out a section of a large file like this:
ffmpeg -i input.wmv -ss 60 -t 60 -acodec copy -vcodec copy output.wmv
The -ss part works fine but the -t is ignored. It correctly ...
71
votes
4
answers
39k
views
Which special variables are available when writing a shell command for a context menu
When extending the Windows' shell context menu (e.g. for adding an 'Open command here' prompt on directories), a 'command' key needs to be created in the registry.
The value of this 'command' key ...
134
votes
17
answers
486k
views
Is it possible to download using the Windows command line?
Without using any non-standard (Windows included) utilities, is it possible to download using the Windows command line?
The preferred version is Windows XP, but it's also interesting to know for ...
46
votes
10
answers
170k
views
Turn on/off Bluetooth radio/adapter from cmd/powershell in Windows 10
Such a simple task, one would say, and I haven't found a satisfiable solution. What I've tried (with music playing through a Bluetooth-connected speaker to really know the state of the radio):
using ...
31
votes
6
answers
169k
views
Change Windows sound volume via the command line
Is it possible to change the volume in Windows XP via the command line?
247
votes
11
answers
205k
views
Windows equivalent of whereis?
Is there an equivalent of the Unix whereis command in Windows?
So that I could figure out where commands I can run actually is.
84
votes
9
answers
257k
views
Remove USB device from command line
I'm constructing a backup script for Windows 7, and the last action I want it to perform is to safely "remove" the USB drive that it is backing up to. I am under the impression that plugging the drive ...
4
votes
5
answers
2k
views
WinXP dir command: 3 and 4 char extensions are the same?
I'm trying to recursively search a directory tree to find all of the .asp files using the following command:
dir *.asp /s
For some reason, this returns not only the asp files, but also the aspx ...
228
votes
8
answers
169k
views
Typing “python” on Windows 10 (version 1903) command prompt opens Microsoft store
This is strange issue I have observed. I installed Active Python 2.7 on Windows 10 (version 1903).
On typing “python” from search, opens the Python 2.7 prompt but when I type from command prompt ...
144
votes
6
answers
66k
views
Does bash have a hook that is run before executing a command?
In bash, can I arrange for a function to be executed just before running a command?
There is $PROMPT_COMMAND, which is executed before showing a prompt, i.e., just after running a command.
Bash's $...
130
votes
12
answers
301k
views
How can I open a command prompt in current folder with a keyboard shortcut?
How can I open a command prompt in current folder with a keyboard shortcut in Windows 7?
Is there any way to implement this?
I think Autohotkey could do this, but don't know how.
126
votes
6
answers
631k
views
A command-line or batch cmd to concatenate multiple files
I have 50 text files in one directory.
Is there a Windows command-line method to concatenate those files into a single file?
I am using Windows Vista.
I don't want to type the name of all files.
110
votes
10
answers
450k
views
How to make a shortcut from CMD?
How can I create a shortcut file (.lnk) to another file or executable, using command line utilities?
101
votes
5
answers
103k
views
How do I access MTP devices on the command line in Windows?
Most MTP (Media Transfer Protocol) devices show up in Windows File Explorer under their device name or a GUID, but they don't have a drive letter assigned.
How can I access the files on such devices ...
6
votes
1
answer
4k
views
How can I single-quote or escape the whole command line in Bash conveniently?
Introduction
Consider a tool like watch that can take another command (e.g. ls -l) like this:
watch ls -l
# or equivalently
watch 'ls -l'
If the command is more complicated, it's all about quoting/...
216
votes
9
answers
412k
views
How do I find out what version of Linux I'm running?
Is there a way to determine what version (distribution & kernel version, I suppose) of Linux is running (from the command-line), that works on any Linux system?
89
votes
6
answers
168k
views
Variables in batch file not being set when inside IF?
I have two examples of very simple batch files:
Assigning a value to a variable:
@echo off
set FOO=1
echo FOO: %FOO%
pause
echo on
Which, as expected, results in:
FOO: 1
Press any key to continue ...
53
votes
5
answers
62k
views
Create permanent DOSKEY in Windows cmd
I think the title is pretty self explanatory.
The question is how can I create an alias in a Windows cmd that will also work after I close and then reopen it. For example I would like an alias ...
63
votes
9
answers
210k
views
What is the command to use to put your computer to sleep (not hibernate)?
I want to put my Windows PC (Windows 7) into a sleep state via command line (so I can bind to macro button on keyboard).
The power button on the PC is setup to but the computer to sleep (but it's ...
7
votes
2
answers
1k
views
What does ">> file command" do, and how does it differ from "command >> file"?
Picking up from this highly voted comment to What does `>>` mean in terminal command?:
"program before" What does that mean? Command obviously, but redirections can also be written prepended, ...
307
votes
5
answers
960k
views
Setting and getting Windows environment variables from the command prompt?
I want to set an environment variable from the command prompt and then be able to access it globally (for instance, I should see it by going to System -> Environment Variables).
When I use the set ...
253
votes
8
answers
24k
views
What do the parentheses and number after a Unix command or C function mean?
I keep seeing parentheses and a number after a command in Unix or Linux or C function.
For example: man(8), ftok(2), mount(8), etc.
What do these mean? I see them in man too.
45
votes
7
answers
65k
views
crossfade between 2 videos using ffmpeg
I've been trying to achieve a crossfade transition between 2 video clips using ffmpeg but have failed so far. I'm new to ffmpeg and am mostly relying on tweaking what I can find in the documentation ...
39
votes
10
answers
147k
views
On Windows 7, is there a command prompt line that can start cmd as an administrator? [duplicate]
On Linux, we can use
sudo bash
to run a shell as the superuser.
On Windows 7, we can use
Start menu -> (in search box, type) cmd -> Right click on search result and choose Run as Administrator
...
17
votes
8
answers
168k
views
How to change keyboard layout via command line cmd.exe on Windows XP/7?
Is is possible to change the keyboard layout via command line on Windows XP/7?
14
votes
3
answers
51k
views
Completely disable UAC in Windows 10
When I was running Windows 7 Ultimate 32-bit, I had UAC disabled and everything was working smoothly for me. Now I've updated to Windows 10 Pro 32-bit (and recently also the 2015-11 update), I'm ...
13
votes
6
answers
134k
views
Command-line FTP function does not work
I am using Windows 7 and have multiple FTP client applications working without any problem. However, when I use command-line FTP, I can get connected, log in (after entering user name and password), ...
171
votes
9
answers
596k
views
How to run a batch file without launching a "command window"? [duplicate]
On Windows XP, can I run a batch (.bat or .cmd) file, via a shortcut, without a "black window"?
111
votes
16
answers
110k
views
How can I trigger a notification when a job/process ends?
The place I work at has commands that take a long time to execute.
Is there a command/utility that I can use to notify me when the command execution is over? It could be a popup window or maybe a ...
90
votes
15
answers
363k
views
Windows command that returns external IP
Is there a command by which I can find my external IP of my router or my NAT\DSL Router, etc., eliminating the need to visit whatsmyip.net or similar.
65
votes
12
answers
378k
views
How to prevent the command prompt from closing after execution?
My problem is that in Windows, there are command line windows that close immediately after execution. To solve this, I want the default behavior to be that the window is kept open. Normally, this ...
65
votes
13
answers
257k
views
Take a screen shot from command line in Windows
I am looking for a way to take a screenshot of the entire screen from the command line. Operating system is Windows. Something like this:
C:\>screenshot.exe screen1.png
58
votes
4
answers
164k
views
How to cut at exact frames using ffmpeg?
I'm trying to use ffmpeg to cut video files at precise times. The ffmpeg help shows an option -timecode_frame_start to specify the starting frame but I am unable to get this command to work. The ...
53
votes
17
answers
270k
views
How do you open the command prompt in Windows 7 with a shortcut key?
Is it possible to open the command prompt with Windows 7 with a shortcut key, and if it is, how do you do it?
I know that I can assign a shortcut key to it, but does Windows come with a shortcut key ...
45
votes
10
answers
92k
views
Windows 7 Administrator Command Prompt "Start in" Path
So, I know you can create a shortcut to an administrator-level command prompt (as described in this question), but what I'm seeing is that whenever I use such a shortcut, it always drops me into c:\...
222
votes
7
answers
470k
views
Browse an UNC path using Windows CMD without mapping it to a network drive
C:\> cd \\somewhere
'\\somewhere'
CMD does not support UNC paths as current directories.
What I usually do to get around this is to map that directory to a network drive and then I could easily ...
145
votes
8
answers
172k
views
Where does $PATH get set in OS X 10.6 Snow Leopard?
I type echo $PATH on the command line and get
/opt/local/bin:/opt/local/sbin:/Users/andrew/bin:/usr/local/bin:/usr/local/mysql/bin:/usr/local/pear/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/...