Questions tagged [cmd]

Command Prompt (executable name cmd.exe) is the Microsoft supplied command line interpreter on OS/2, Windows CE, and all Microsoft Windows operating systems. Use this tag for questions regarding programming scripts or on commands available to run from the Command Prompt. Add tags for which version of Windows, and tags describing the task or issue.

Command Prompt (executable name cmd.exe) is the Microsoft-supplied command-line interpreter on Windows NT-based operating systems (including Windows 2000, XP, Vista, 7, 8, 10, Server 2003, Server 2008, Server 2012 and Server 2016), OS/2 and Windows CE. It is the analog of COMMAND.COM in MS-DOS and Windows 9x (where it is called MS-DOS Prompt) systems, or of the Unix shells used on Unix-like systems.

Include additional tags to identify the version of Windows such as , , , etc.

Resources:

See also:

26386 questions
106
votes
19 answers

Can I mask an input text in a bat file?

I am writing a batch file to execute some other programs. In this case I need to prompt for a password. Do I have any way to mask the input text? I don't need to print ******* characters instead of input characters. Linux's Password prompt behavior…
Chathuranga Chandrasekara
  • 20,548
  • 30
  • 97
  • 138
103
votes
3 answers

How to read input from console in a batch file?

How do I read input from the console in a batch file? What I am trying to achieve is the functionality of scanf in C. How can I do the same in a batch file?
Nohsib
  • 3,614
  • 14
  • 51
  • 63
103
votes
9 answers

How to install Visual Studio Code extensions from Command line

How to install Visual Studio Code Extensions from Command Prompt while Code Instance is open. I want to install extension from Visual Studio Code gallery. Following is the extension data i want to install. My Visual Studio Code Instance is open.…
Shan Khan
  • 9,667
  • 17
  • 61
  • 111
103
votes
7 answers

XCOPY still asking (F = file, D = directory) confirmation

My batch script xcopy is still asking F = file, D = directory confirmation even though I have added /F in the script, the log is showing as below. Please help on how to avoid asking confirmation. Script: net use p: /delete net use p:…
Testuser
  • 1,107
  • 2
  • 7
  • 15
103
votes
7 answers

Get user's non-truncated Active Directory groups from command line

I often use the net user command to have a look at AD groups for a user: net user /DOMAIN This works well, however the group names are truncated to around 20 characters. And in my organization, most group names are much longer than…
Ben
  • 6,567
  • 10
  • 42
  • 64
102
votes
7 answers

How do I run a bat file in the background from another bat file?

I have a "setup" script which I run in the morning which starts all the programs that I need. Now some of those need additional setup of the environment, so I need to wrap them in small BAT scripts. How do I run such a script on Windows XP in the…
Aaron Digulla
  • 321,842
  • 108
  • 597
  • 820
101
votes
5 answers

How do I remove a cmd variable?

Let's say I execute the following in the CMD shell: SET "FOO=bar" Is there a way to undefine this variable, other than recycling the CMD shell?
user288004
  • 1,111
  • 2
  • 7
  • 3
101
votes
7 answers

How to use GNU Make on Windows?

I installed MinGW and MSYS, added C:\MinGW\bin to PATH but I still can't run Makefile on Windows' cmd. I would like to run cmd.exe and there type, for example, make all but my cmd says that there is no such command. What should I do? I don't want…
yak
  • 3,770
  • 19
  • 60
  • 111
99
votes
20 answers

Creating a file name as a timestamp in a batch job

We have a batch job that runs every day and copies a file to a pickup folder. I want to also take a copy of that file and drop it into an archive folder with the filename yyyy-MM-dd.log What's the easiest way to do this in a Windows batch job? I'm…
Eoin Campbell
  • 43,500
  • 17
  • 101
  • 157
98
votes
16 answers

Windows batch command(s) to read first line from text file

How can I read the first line from a text file using a Windows batch file? Since the file is large I only want to deal with the first line.
Jesse Vogt
  • 16,229
  • 16
  • 59
  • 72
95
votes
7 answers

How to overlay/downmix two audio files using ffmpeg

Can I overlay/downmix two audio mp3 files into one mp3 output file using ffmpeg?
Faisal
  • 1,307
  • 1
  • 10
  • 16
94
votes
6 answers

What is equivalent to Linux mkdir -p in Windows?

In Linux, mkdir -p creates a folder tree. What is the equivalent option in Windows to create a folder tree? Is there any?
Renjith G
  • 6,307
  • 9
  • 27
  • 26
94
votes
2 answers

What does it mean by command cd /d %~dp0 in Windows

Can someone please help me to understand the command cd /d %~dp0 and its purposes. Again dos command is below cd /d %~dp0 Please help me to get the meaning of it.
Indranil Sarkar
  • 1,220
  • 1
  • 14
  • 22
92
votes
23 answers

How to test if a file is a directory in a batch script?

Is there any way to find out if a file is a directory? I have the file name in a variable. In Perl I can do this: if(-d $var) { print "it's a directory\n" }
Vhaerun
  • 12,806
  • 16
  • 39
  • 38
92
votes
1 answer

How to execute multiple commands in a single line

I know Unix has the following command which can execute multiple commands in a single line, how can I do this in DOS? command1 ; command2 ; command3 ...
zdd
  • 8,258
  • 8
  • 46
  • 75