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
8
votes
8 answers

how to easily reconnect to "unavailable" network shares

Every once in a while, I run cmd as my admin user. I set up a shortcut for convenience sake... C:\Windows\System32\runas.exe /u:admin.user@domain cmd At some point, I've wanted to run scripts that point at mapped drives available to my regular…
Pete
  • 271
  • 1
  • 4
  • 19
8
votes
4 answers

Determine if C drive has 2 GB of free disk space

I am trying to determine if a target pc has atleast 2 GB of free space. Here is what I have so far: @echo off for /f "usebackq delims== tokens=2" %%x in (`wmic logicaldisk where "DeviceID='C:'" get FreeSpace /format:value`) do set…
8
votes
3 answers

How to escape the > sign on Windows command line?

For example, foo -option 10->30 file.ext (this is an actual syntax required) redirects the output to a file named 30. How do I make cmd understand that I would like to pass the actual > character? I've tried several forms of double quotes to no…
MaxVT
  • 183
  • 1
  • 5
7
votes
1 answer

NET USE command doesn't authenticate when credentials are passed as parameters

I'm trying to connect to a remote WebDAV server by mapping it as a drive using NET USE command. NET USE * /user: Executing this command gives the following error: System error 1244 has occurred. The operation being…
7
votes
0 answers

Windows: 'Query User' command reporting idle time inaccurately (false positives)

I'm working with ten other sysadmins that sometimes forget to log out of servers (or even lock them). For two days or more, I've been trying to come up with a 'script' that'll check each server we manage for idle administrator accounts. If they've…
soj4trade
  • 71
  • 1
  • 2
7
votes
0 answers

cmd.exe as a built-in application pool identity

My IIS web applications run using the built-in application pool identity IIS APPPOOL\Foo. Is it possible to run a command-line in the context of IIS APPPOOL\Foo using psexec or some other tool? There are various blog entries out there showing how to…
Heinzi
  • 2,217
  • 5
  • 32
  • 52
7
votes
2 answers

Rename files to add date modified to filename with Windows CMD or simple .TXT

I am attempting to rename a large batch of files to incorporate the dates in the "Date Modified" column from File Explorer into each filename in YYYYMMDD format. I was able to generate a report from the desired file folder of all the files inside…
7
votes
2 answers

How do you check what version of Server Message Block client a workstation is using on Windows?

Sometimes over slow connections we switch to an older version of the protocol. I'd like to be able to check and see which version is being used, I only know how to set the version ala: sc.exe config lanmanworkstation depend= bowser/mrxsmb10/nsi…
leeand00
  • 4,869
  • 15
  • 69
  • 110
6
votes
6 answers

Correct technique to find application in 32 and 64 bit versions of Vista/Windows 7 from CMD.EXE

BACKGROUND I have an existing CMD script that works fine. It launches an app from PROGRAM FILES like so "%PROGRAMFILES%\MyApp\app.exe" PROBLEM it works fine on 32-bit versions of Windows (Vista, Windows 7) but on 64-bit versions of Windows the…
user2666
  • 285
  • 2
  • 6
  • 8
6
votes
2 answers

How can we insert multiple keys into a registry folder without using 3rd party tools?

To insert multiple keys into a registry folder (e.g. Computer\HKEY_CLASSES_ROOT\....\....), I basically have to manually right click → New → Key for each key. This can get annoying and redundant, especially at times when I need to insert more than…
Pacerier
  • 521
  • 16
  • 35
6
votes
3 answers

How to run x64 bit version of registry from cmd.exe located under c:\windows\sysWow64

I have a 32 bit application which has to add a value to x64 bit portion of the registry. I want to do it through utilization of regedit.exe -s fileWithKeys.reg, However when I try to span regedit (in the code of the application, I utilized…
Darqer
  • 299
  • 1
  • 3
  • 10
6
votes
2 answers

Checking if shared folder exists using CMD

How I could check if network folder shared exists using batch script? Example: \\10.10.10.1\folder1\folder2\shared_folder
gedO
  • 267
  • 1
  • 4
  • 12
6
votes
1 answer

Is there a cmd/certutils to copy a certificate from one store to another?

I would like to know if there is a cmd to copy an existing certificate from one store to another. I am trying to copy a certificate from the Users Intermediate Certification Authorities store (certutils -user -store ca fqdn-HOST-CA) to the machine's…
6
votes
2 answers

How to start SMTP virtualhost [SMTP Virtual Server #1] through powershell or command prompt

Because of some error on my server, my SMTP service [SMTP Virtual Server #1] stops. I want to create job which will run periodically to check the SMTP server status, if it is stopped then the script will start it again. I have used Start-Service…
6
votes
3 answers

Windows: How do I add a program to the system's path environmental variable from the command line?

I'm looking to permanently add a directory to the %PATH% environmental available on a large number of Windows machines. Is there any way to do this from a command line (cmd) so I can script up a solution, rather than having to use GUI on dozens of…
1 2
3
25 26