Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [cmd.exe]

cmd.exe, or the Command Prompt, is the default command-line interpreter for many Microsoft-created operating systems.

224
votes
13answers
507k views

Grep equivalent for Windows 7?

Is there a command prompt grep equivalent for Windows 7? That is, I want to filter out the results of a command: Bash use: ls | grep root What would it be from a Windows command prompt?
221
votes
7answers
506k views

How to recursively delete directory from command line in windows?

What is the windows equivalent of rm -r [directory-name]?
85
votes
9answers
31k views

How to open Windows CMD so that it starts in the current folder? [duplicate]

When I'm working in a folder in Windows Explorer, sometimes I have a need to run some CMD command in this folder. How do I open the command line from a current folder, so the console opens in the ...
77
votes
3answers
21k views

Is typing %^ into cmd.exe a Windows easter egg?

When I typed %^ in cmd and pressed Enter, and it said: More? When I pressed Enter again, it gave the same response. Is this an Easter Egg? What is this?
69
votes
5answers
41k views

Turning off the cmd window beep sound

Is there a way to essentially mute the Beeping function of the Windows command shell? I'm working on a PowerShell script right now which ends up printing several lines of text to the screen. I'm ...
56
votes
2answers
85k views

Why is my localhost not 127.0.0.1 but ::1, and what notation is that? [duplicate]

When I use the Ping command against my localhost (on Windows Vista), it doesn't show up as 127.0.0.1. C:\Windows\system32>ping localhost Pinging GIGA [::1] from ::1 with 32 bytes of data: ...
43
votes
6answers
146k views

netstat with process name?

Using netstat -a -o -n I can get the list of ports and PID then I need to go to task manager and add the PID and see who is it. (pretty frustrating) I was wonder if there is a CMD command which ...
41
votes
1answer
6k views

Why does a file get opened when I write its name, without extensions, in the command line?

On Windows 10, I have a file called truffle.js in my current folder. I write truffle in the cmd window, expecting to invoke the truffle program which resides elsewhere on my path. Instead, truffle.js ...
34
votes
7answers
395k views

Running .exe in command prompt

I'm trying to run an iteration program, and whenever I click on it, it opens then terminates. When I open the input text file, using the program, the iteration completes, then the window instantly ...
34
votes
3answers
77k views

How to copy a file to a directory in DOS, and create directories if necessary?

How can I copy a file using DOS commands into a directory structure that may not yet exist? I need to be able to force the creation of the directory path to the target file location if that location ...
25
votes
1answer
5k views

What is the difference between “shutdown /r” and “shutdown /g”?

I was reading some of the options for the shutdown command in windows, when I stumbled across the following option descriptions: /r Full shutdown and restart the computer. /g Full ...
21
votes
12answers
49k views

Play a sound (maybe WAV?) from Windows line command

How can i play a sound (CPU Beep or wav, don't matter what) using the Windows cmd?
21
votes
1answer
4k views

send a file via bluetooth from the command prompt

I'm working with the command prompt and I would like to send a file to my phone. Is it possible to send a file via bluetooth from the command prompt?
19
votes
2answers
23k views

Force cmd.exe prompt to run NOT as admin

Related to my other question, I need to be able to run the command prompt NOT as an admin. Whenever I launch a command prompt, either from the Start Menu, or by double clicking the C:\Windows\System32\...
18
votes
1answer
2k views

Pinging different IP address than what I entered [duplicate]

Can anyone please explain why CMD pings a different IP address than the one I am searching for?
18
votes
6answers
60k views

Checking disk capacity in windows of remote servers

I am working in windows and I wanna to find out through command line disk capacity of remote windows servers. For ex: I am @localhost, now I want to know whether D: drive of server 172.68.68.68 is ...
17
votes
5answers
8k views

dir C: vs dir C:\

I've accidentally found that if I do: dir C:\ I get a list of files that are direct children of the C: drive, in the root. However, if I do: dir C: I get a huge list of files that I'm not even ...
17
votes
8answers
15k views

Easiest way to get right-click “Open command window here” with admin priveleges in Windows 7

I don't want to install PowerToys, I'd rather a simpler solution for this specific problem. I've tried Ctrl+Shift+Right-Click. I've tried adding a registry script, but I get the following error: ...
16
votes
1answer
28k views

Change working directory to network share

I can list all files in a folder with: dir \\aenw08v401\FOLDER\I001\* However, when I execute cd \\aenw08v401\FOLDER\I001, the current working directory won't change at all. This is what I see when ...
15
votes
2answers
33k views

Switching default audio device with a batch file

I'm trying to write a batch file on Windows 10 that allows me to switch between my headset and my speakers as default audio device when I run it. I don't want to use any third-party software. I tried ...
14
votes
2answers
15k views

Does using Windows CMD to shut down a computer cause any damage?

When you launch shutdown -i to shutdown a computer from the command prompt (CMD), does it damage the computer that is being turned off (either local or remote)?
14
votes
3answers
90k views

Open CMD as admin with Windows+R shortcut

My preference for running CMD is to use Windows+R » type cmd » Enter. But this doesn't open it with admin rights. Is there a way to type your way through to command prompt with admin rights?
14
votes
2answers
106k views

Error in command line “The system cannot find the path specified.”

Not sure what I did but since past 5 weeks but I am getting this error The system cannot find the path specified. when I run any command or start cmd. Here is what I get when I start command line: ...
14
votes
3answers
17k views

Can I use the “start” command with spaces in the path?

I have a path like this: Y:\xxx\dd sss\aaa\ccc Y:\ is mapped to an FTP address. Now when I try to use start to open my folder I cannot. Command prompt makes mistake a and goes to Y:\xxx\dd folder! I ...
14
votes
1answer
1k views

What does ^& represent in Windows command line?

I've noticed the usage of ^& in: (robocopy c:\dirA c:\dirB *.*) ^& IF %ERRORLEVEL% LSS 8 SET ERRORLEVEL = 0 I am wondering what does it do?
14
votes
1answer
4k views

How do I deal with emoji in Command Prompt?

The hotspot I'm connected to has the SSID 12346🐷. I need to use the netsh wlan show profile <SSID> command, but cmd doesn't appear to have unicode support. What do I do?
13
votes
2answers
73k views

How can I list directories and their sizes in command prompt?

I would like to see sizes of subfolders in a folder, similar to linux du -sh command. How can I list directories and their sizes in command prompt?
13
votes
0answers
3k views

Why doesn't windows command prompt still support ctrl + v? [closed]

This is just one of those things that I started wondering about. Why aren't the copy/paste keyboard shortcuts (that we all love) in command prompt not aligned with the rest of the software population?...
12
votes
3answers
1k views

Open Networks folder through cmd?

How can I open the networks folder (equivalent of click "networks" in windows explorer) from a batch file or cmd? I thought I could just do explorer \\ but that didn't work.
12
votes
1answer
13k views

Why unload variables in Windows batch files

Is it considered necessary or good practice to unload variables used in Windows batch files? For example in the following code, is the set myFolder= at the end necessary? @echo off set myFolder="C:\...
12
votes
3answers
4k views

How to use “<<” in batch file or command prompt?

I know what >> is used for, it write all messages into a file instead of screen. And I guess << do reverse, I try it and receive a message: << was unexpected at this time. Please ...
12
votes
6answers
21k views

Is there a keyboard shortcut to pause the output of a CMD window while it's running?

I'm in the middle of running a batch script that's taking a really long time and whose output is whizzing by at an unreadable rate. Is there a keyboard shortcut that allows you to pause the CMD ...
11
votes
2answers
14k views

How to show full command line of all processes in Windows

On Windows, in the Task Manager it is possible to see the command line of each processes but it is truncated. How can I see the complete command line of each running process?
11
votes
1answer
32k views

How to add installed program to command prompt in windows?

I have a problem with adding already installed program as available command in windows cmd. For example I installed new text Geany and want to open text file using this command: geany myfile.txt I ...
10
votes
2answers
13k views

Emulate a keyboard button via the Command Line

My keyboard doesn't have a Num Lock key, and none of the registry edits work for some reason. Can I use the Command Prompt or PowerShell on Windows 10 to "press" a key? I'm looking for something ...
10
votes
2answers
767 views

What's the difference between the following cmd scripts?

I've tried launching several programs through a batch file and encountered problems but that is in the past. I'm relatively new to scripts and command lines and this would be my question: What's the ...
10
votes
3answers
3k views

Virtual Desktop Properties To Command Line

Is there a way from the command line (wmic, regedit, or dedicated tool) to check how many Virtual Desktops in Windows 10 are active, in which a window is, and which one the computer is currently using?...
10
votes
4answers
22k views

Finding multiple file extensions in command prompt window

I am trying to use multiple parameters to find 3 different extensions in my windows/system32 in one command: .exe, .dll and .sys This is giving me what I want, but I can't figure out how to get all 3 ...
10
votes
2answers
22k views

Tasklist shows process but taskkill is unable to kill it, even as admin

I am trying to kill chrome on my computer. I ran command prompt as an admin and ran: C:\WINDOWS\system32>tasklist /FI "IMAGENAME eq chrome.exe" This returned one item: Image Name ...
10
votes
1answer
32k views

How to change CMD start directory [duplicate]

I want to change the CMD startup directory when I launch it via Start+R Currently, it points to my users folder. I need it to point to C:\Windows\System32\ When I navigate manually to C:\Windows\...
10
votes
1answer
2k views

Can I reverse the stream direction of my terminal?

I'm not sure on how to word this question any other way but that's it. Is it possible to reverse the way your terminal prints text? For example if I type a command, I type it from the bottom of the ...
9
votes
2answers
777 views

Open the folder associated with the Command Prompt's working directory? [duplicate]

I am wondering if there is a command one could type into The Windows Command Prompt which would cause Windows Explorer to open a folder set at the Command Prompt's current working directory? (This ...
9
votes
6answers
6k views

Create a batch file or shortcut to PuTTY (ssh) that opens a session and runs a command

I often find myself opening an SSH session to run the same single command. I have everything setup to login without entering a password (Via SSH Key-Based Auth), so I wondered if there was a way to ...
9
votes
1answer
2k views

Batch file opens Default Browser instead of Firefox

I have a login script that runs for every user. The first check sees if the username matches our Test-Taking User (exam). If so, launches Firefox to the exam homepage and stops. The commands ...
9
votes
3answers
43k views

How to find the PCs name in a batch script?

How would I find the name of the PC running my batch program on it? I would like to find the name of a PC that is running my batch program and be able to store it as a variable. Any help?
9
votes
4answers
8k views

Windows PowerShell - How to view commands history date/time

I want to list entered commands in Windows PowerShell with their respective timestamps. How can I do it with Get-History command? Also if that isn't doable then please show me a way to check which ...
9
votes
7answers
37k views

Set Internet Explorer as the default browser from the command line

Is it possible to set Internet Explorer as the default browser to launch from the command line? I have a web application that only runs under Internet Explorer, but if it happens that Firefox is ...
9
votes
2answers
27k views

How to force short name (8dot3) generation?

I have a problem with windows windows shortnames. Sometimes the short names do not seem to be generated for "Program Files" and "Program Files (x86)". I verified that short name generation is enabled ...
8
votes
8answers
32k views

Check for only numerical input in batch file

In the Windows NT-based command line (mostly for XP or higher), is there a way to verify if a switch being provided is a number only? Depending on the number, I want it to loop through the code x ...
8
votes
3answers
1k views

I cannot move a file inside a folder on Desktop, back to Desktop

I have a folder: C:\users\julio\desktop\testfolder I am learning to use Command Prompt and I am having trouble moving a file from testfolder to Desktop. I first moved the file to testfolder and it ...