Questions tagged [windows-command-prompt]

Refers to the default CLI that ships with all versions of Windows, often shortened to just "command prompt" or cmd (after the file name of the executable).

Refers to the default CLI that ships with all versions of Windows, often shortened to just "command prompt" or cmd (after the file name of the executable).

383 questions
280
votes
160 answers

Useful Command-line Commands on Windows

The aim for this Wiki is to promote using a command to open up commonly used applications without having to go through many mouse clicks - thus saving time on monitoring and troubleshooting Windows machines. Answer entries need to…
dance2die
  • 2,011
  • 7
  • 32
  • 41
168
votes
11 answers

Run a .bat file in a scheduled task without a window

I have a scheduled task that starts a batch script that runs robocopy every hour. Every time it runs a window pops up on the desktop with robocopy's output, which I don't really want to see. I managed to make the window appear minimized by making…
156
votes
12 answers

Is there a global, persistent CMD history?

Sometimes I forget how the exact syntax of a CMD command looks and then I would like to search my own CMD history. Clearly, within the same session, you can browse it with the up and down arrow keys but what about the history of former CMD sessions?…
raoulsson
  • 4,763
  • 10
  • 34
  • 29
62
votes
7 answers

Windows command prompt: how do I get the output of a command into a environment variable?

I want to have an environment variable that contains the day of week in cmd.exe. When I run this command I get the result I want. C:\Users\tisc> powershell (get-date).dayofweek Friday Here I'm trying to store the result in an environment…
Tim
  • 721
  • 1
  • 5
  • 8
51
votes
2 answers

Windows: redirect stdout and stderror to nothing

I have a command I am running produces a ton of output, I want to silence the output without writing to a file. I have used the following to send all output to a file: command > out.txt 2>&1 ... but again I don't want any file output: command >…
Alec Gorge
  • 627
  • 1
  • 5
  • 9
46
votes
9 answers

System error 1219 has occurred

I am trying to connect to a remote server and deploy a service there, through a deploy script. I start by stating "Net use" and send the credentials for the server. But here I get system 1219 error: Multiple connections to a server or shared…
khebbie
  • 680
  • 1
  • 6
  • 12
44
votes
13 answers

How do you handle "CMD does not support UNC paths as current directories"?

I am attempting to change directories to a file server such as: cd \\someServer\\someStuff\ However, I get the following error: CMD does not support UNC paths as current directories What are my options to navigate to that directory?
Ray
  • 720
  • 1
  • 9
  • 13
42
votes
8 answers

How do I restart a Windows service from a script?

I have a batch script that looks like: sc stop myservice sc start myservice it errors out because sc doesn't wait till the service is stopped. How do I restart a service with a script?
Joshua
  • 779
  • 1
  • 9
  • 19
42
votes
5 answers

What's the difference between .cmd and .bat files?

Just curious. "Cool" people in our company always use *.cmd while no one was able to explain the difference to me.
Artem Tikhomirov
  • 742
  • 3
  • 9
  • 15
38
votes
4 answers

Get directory containing the currently executed batch script

I use %0 in batch file to get the containing directory of the batch file but the result is :- c:\folder1\folder2\batch.bat I want just directory, without batch file name, like this :- c:\folder1\folder2\ How can I do it? Maybe I should filter the…
35
votes
4 answers

Given a PID on Windows - how do I find the command line instruction that executed it?

On a database, I can get a list of all the currently running processes, and the sql command that kicked them off. I'd like to do a similar thing on a windows box. I can get the list of processes, but not the command line that kicked them off. My…
Hawkeye
  • 2,699
  • 9
  • 30
  • 35
33
votes
5 answers

Current date in the file name

I have scheduled backup script that makes the database dump. How can I add the date timestamp to the file name? I am talking about Windows and CMD.
Bogdan Gusiev
  • 593
  • 2
  • 6
  • 9
32
votes
5 answers

Open a new cmd console on Windows 2012 Server core after closing the last one?

On my new test server, which is a Windows Server 2012 core server, I've closed the only open cmd console with the exit command. How do I open another prompt now? Am I going to be forced to reboot the machine?
29
votes
14 answers

How to get a list of drive letters on a system through a windows shell (bat, cmd)?

How do I get a list of drive letters and their associated labels on a windows system through a bat file?
Chris Magnuson
  • 3,771
  • 10
  • 42
  • 46
28
votes
1 answer

Force "net user" command to set password longer than 14 characters

I'm issuing some "net user" commands to setup a local user on my desktop for some testing purposes and require setting a password longer than 14 characters. In doing so Windows barks back a propmt to confirm the long password, and I'm wondering if…
jxramos
  • 789
  • 1
  • 8
  • 11
1
2 3
25 26