Windows run command from cmd

Windows Start | Run commands

Description Run Command
Accessibility Options utilman
or
control access.cpl
Add Hardware Wizard hdwwiz
Programs and Features
(Add New Programs)
(Add Remove Windows Components)
(Set Program Access & Defaults )
appwiz.cpl
control appwiz.cpl,,1
control appwiz.cpl,,2
control appwiz.cpl,,3
Administrative Tools control admintools
Advanced User Accounts Control Panel netplwiz
Authorization Manager azman.msc
Automatic Update control wuaucpl.cpl
Backup and Restore Utility sdclt
Bluetooth Transfer Wizard fsquirt
Calculator calc
Certificate Manager certmgr.msc
Character Map charmap
Check Disk Utility chkdsk
Clear Type (tune or turn off) cttune
Color Management colorcpl.exe
Command Prompt cmd
Component Services dcomcnfg
or
comexp.msc
Computer Management CompMgmtLauncher.exe
or
compmgmt.msc
Control Panel control
Credential (passwords) Backup and Restore Wizard credwiz
Data Execution Prevention SystemPropertiesDataExecutionPrevention
Date and Time Properties timedate.cpl
Device Manager hdwwiz
or
devmgmt.msc
Device Pairing Wizard DevicePairingWizard
Digitizer Calibration Tool (Tablets/Touch screens) tabcal
Direct X Control Panel (if installed) directx.cpl
Direct X Troubleshooter dxdiag
Disk Cleanup Utility cleanmgr
Disk Defragmenter dfrgui
defrag
Disk Management diskmgmt.msc
Disk Partition Manager diskpart
Display Color Calibration dccw
Display DPI / Text size dpiscaling
Display Properties (Themes, Desktop, Screensaver) control desktop
Display Properties (Resolution, Orientation) desk.cpl
Display Properties (Color & Appearance) control color
Documents (open ‘My Documents’ folder) documents
Downloads (open ‘Downloads’ folder) downloads
Driver Verifier Utility verifier
DVD Player dvdplay
Edit Environment Variables rundll32.exe sysdm.cpl,EditEnvironmentVariables
Encrypting File System Wizard (EFS) rekeywiz
Event Viewer eventvwr.msc
File Signature Verification Tool (Device drivers) sigverif
Files and Settings Transfer Tool %systemroot%\system32\migwiz\migwiz.exe
Firewall Control Panel firewall.cpl
Folders Properties control folders
Fonts list control fonts
Font preview fontview arial.ttf
Game Controllers joy.cpl
Local Group Policy Editor gpedit.msc
Internet Properties inetcpl.cpl
IP Configuration ipconfig
iSCSI Initiator configuration iscsicpl
Keyboard Properties control keyboard
Language Pack Installer lpksetup
Local Security Policy secpol.msc
Local Users and Groups lusrmgr.msc
Log out logoff
Microsoft Malicious Software Removal Tool mrt
Microsoft Management Console mmc
Access (Microsoft Office) msaccess
Excel (Microsoft Office) Excel
Powerpoint (Microsoft Office) powerpnt
Word (Microsoft Office) winword
Microsoft Paint mspaint
Microsoft Support Diagnostic Tool msdt
Mouse Properties control mouse
or
main.cpl
Network Connections control netconnections
or
ncpa.cpl
Projector:
Connect to Network Projector
Switch projector display
netproj

displayswitch Notepad notepad ODBC Data Source Admin
Default ODBC driver:
32-bit ODBC driver under 64-bit platform: C:\windows\system32\odbcad32.exe
C:\windows\sysWOW64\odbcad32.exe ODBC configuration — Install/configure MDAC drivers odbcconf On Screen Keyboard osk OOB Getting Started gettingstarted Password — Create a Windows Password Reset Disk (USB) «C:\Windows\system32\rundll32.exe» keymgr.dll,PRShowSaveWizardExW Pen and Touch (Tablet/Pen input configuration) tabletpc.cpl Performance Monitor perfmon.msc Phone and Modem Options telephon.cpl Phone Dialer dialer Power Configuration powercfg.cpl and powercfg.exe Presentation Settings PresentationSettings Problem Steps Recorder psr Program Access and Computer Defaults — browser / email / media computerdefaults Printers and Faxes control printers Print Management (.msc) PrintManagement Printer Migration (backup/restore) printbrmui and printbrm.exe Printer user interface (List all printui.dll options) printui Private Character Editor eudcedit Regional Settings — Language, Date/Time format, keyboard locale. intl.cpl Registry Editor regedit Remote Assistance msra Remote Desktop mstsc Resource Monitor resmon Resultant Set of Policy rsop.msc Settings (Windows 10) ms-settings: Scheduled Tasks control schedtasks Screenshot Snipping Tool snippingtool Security Center wscui.cpl Services services.msc Shared Folder Wizard shrpubw Shared Folders fsmgmt.msc Shut Down Windows shutdown Software Licensing/Activation slui Sounds and Audio mmsys.cpl Sound Recorder soundrecorder Sound Volume sndvol Syncronization Tool (Offline files) mobsync System Configuration Utility msconfig System File Checker Utility (Scan/Purge) sfc System Information msinfo32 System Properties

sysdm.cpl SystemProperties
or
sysdm.cpl DisplaySYSDMCPL

System Properties — Performance SystemPropertiesPerformance System Properties — Hardware SystemPropertiesHardware System Properties — Advanced SystemPropertiesAdvanced System Repair — Create a System Repair Disc recdisc System Restore rstrui Task Manager taskmgr Task Scheduler taskschd.msc Telnet Client telnet Trusted Platform Module Initialization Wizard tpmInit User Accounts (Autologon) control userpasswords2 User Account Control (UAC) Settings UserAccountControlSettings User Profiles — Edit/Change type C:\Windows\System32\rundll32.exe sysdm.cpl,EditUserProfiles Windows Disc Image Burning Tool isoburn C:\movies\madmax.iso Windows Explorer explorer.exe
explorer.exe . Will open at the current directory Windows Features optionalfeatures Windows Firewall
Windows Firewall with Advanced Security firewall.cpl
wf.msc Windows Image Acquisition (scanner) wiaacmgr Windows Magnifier magnify Windows Management Infrastructure wmimgmt.msc Windows Memory Diagnostic Scheduler mdsched Windows Mobility Center (Mobile PCs only) mblctr Windows PowerShell powershell Windows PowerShell ISE powershell_ise Windows Security Action Center wscui.cpl Windows Script Host(VBScript) wscript NAME_OF_SCRIPT.VBS Windows System Security Tool. Encrypt the SAM database.
(boot password.) syskey Windows Update wuapp Windows Update Standalone Installer wusa Windows Version (About Windows) winver WordPad write

Unless indicated otherwise, all the commands above work in all versions of Windows from Vista upwards.
Most of these utilities can be found in %systemroot%\System32\

“The Macintosh uses an experimental pointing device called a ‘mouse.’ There is no evidence that people want to use these things”

Batch file to run a command in cmd within a directory

I want to have a batch file(must be placed on desktop) which does the following;

  • opens cmd
  • navigates to a directory, e.g. C:\activiti-5.9\setup
  • runs a command within the directory, e.g. ant demo.start (this command runs the activiti server)

I tried the following to reach to the directory but how to run command, «ant demo.start» ?

Thank you for the help.

EDIT:

Referring to zb226’s answer below: One more question if you can answer me is how to make that cmd to be run as administrator? will the following work?

START cmd /K «runas /user:administrator & cd C:\activiti-5.9\setup & ant demo.start»

6 Answers 6

Chain arbitrary commands using & like this:

Thus, in your particular case, put this line in a batch file on your desktop:

You can also use && to chain commands, albeit this will perform error checking and the execution chain will break if one of the commands fails. The behaviour is detailed here.

Edit: Intrigued by @James K’s comment «You CAN chain the commands, but they will have no effect», I tested some more and to my surprise discovered, that the program I was starting in my original test — firefox.exe — while not existing in a directory in the PATH environment variable, is actually executable anywhere on my system (which really made me wonder — see bottom of answer for explanation). So in fact executing.

. didn’t prove the solution was working. So I chose another program (nLite) after making sure that it was not executable anywhere on my system:

And that works just as my original answer already suggested. A Windows version is not given in the question, but I’m using Windows XP, btw.

How to run a command on command prompt startup in Windows

If you want to perform any task at computer startup or based on an event this is very helpful

Back to the question

I have two questions:

I want some specific commands to be executed when I start command prompt.

e.g. cls to clear my command prompt.

I want to execute some commands in a batch file and wait for the user to enter new commands (if any).

e.g. A batch file which will take the user to some specified folder and then wait for the user to rename/delete a file from the command prompt.

How can I do it?

6 Answers 6

If you want a defined set of commands to run every time you start a command prompt, the best way to achieve that would be to specify an init script in the AutoRun registry value. Create it like this (an expandable string value allows you to use environment variables like %USERPROFILE% ):

Then create a file init.cmd in your profile folder:

To remove these changes, delete the registry key:

  1. Make a shortcut
  2. Go to the properties
  3. The bit where it says: C:\Users\ \Desktop\cmd.exe , you put: -cmd /K

e.g. C:\Users\Lewis\Desktop\cmd.exe -cmd /K color 1f

This is the way to launch 1 command without having to mess about with the registry.

Run multiple commands

You can also use & (and) operator to execute multiple commands.

I found my answer: I should use the /K switch, using which I can enter a new command on the opened command prompt.

E.g. cmd /K cls will open a command prompt for me and clear it. (Answer for question 1)

cmd /K MyBatchFile.bat will start a command prompt, execute the batch file and stay on the command prompt and will not exit. (Answer for question 2).

First, you need to press Windows Key + R. In the box that appears, type «regedit» (without the quotes). The Windows Registry Editor should open. Now, locate to HKEY_CURRENT_USER/Software/Microsoft/Command Processor. Once you have clicked on Command Processor on the left side, click Edit on the top bar. Then go to New > String Value in the Edit menu. Rename the String Value that appears to Autorun. Right click on Autorun and select Modify. Under the «Value Data» area, type in the commands you want to run. You can run multiple by typing && between them.

Expanding a bit, here is an alternative for Windows 10 where multiple aliases can be defined and applied to the Command Prompt upon execution.

  1. Create a file called init.cmd containing aliases on your %USERPROFILE% folder:

init.cmd

  1. Register it to be applied whenever the Command Prompt is executed:

In the Command Prompt, run:

Done

Now the contents of init.cmd will run for executions of cmd.exe namely from:

  • Taskbar shortcut
  • WIN + R cmd
  • By typing cmd in the File Explorer address bar
  • By running cmd.exe directly from C:\Windows\System32

After registering these settings just remember to close/open:

  • The Command Prompt so the settings are applied
  • The File Explorer, if you use to launch the cmd via File Explorer address bar
Читайте также:  Linux не видит айфон
Оцените статью