Start or stop Windows service from command line (CMD)
We normally use Services.msc to start or stop or disable or enable any service. We can do the same from windows command line also using net and sc utilities. Below are commands for controlling the operation of a service.
Command to stop a service:
To start a service:
You need to have administrator privileges to run net start/stop commands. If you are just a normal user on the computer, you would get an error like below.
To disable a service:
To enable a service:
To make a service start automatically with system boot:
Note: Space is mandatory after ‘=’ in the above sc commands.
This SC command works on a Windows 7 machine and also on the down-level editions of Windows i.e Windows XP/2003 and Windows Vista. Again, if you do not have administrator previliges you would get the below error.
Note that the service name is not the display name of a service. Each service is given a unique identification name which can be used with net or sc commands. For example, Remote procedure call (RPC) is the display name of the service. But the service name we need to use in the above commands is RpcSs.
So to start Remote procedure call service the command is:
These service names are listed below for each service. The first column shows the display name of a service and the second column shows the service name that should be used in net start or net stop or sc config commands.
start
Starts a separate Command Prompt window to run a specified program or command.
Syntax
Parameters
Parameter | Description |
---|---|
Specifies the title to display in the Command Prompt window title bar. | |
/d |
. ]]
Remarks
You can run non-executable files through their file association by typing the name of the file as a command.
If you run a command that contains the string CMD as the first token without an extension or path qualifier, CMD is replaced with the value of the COMSPEC variable. This prevents users from picking up cmd from the current directory.
If you run a 32-bit graphical user interface (GUI) application, cmd does not wait for the application to quit before returning to the command prompt. This behavior does not occur if you run the application from a command script.
If you run a command that uses a first token that does not contain an extension, Cmd.exe uses the value of the PATHEXT environment variable to determine which extensions to look for and in what order. The default value for the PATHEXT variable is:
Note that the syntax is the same as the PATH variable, with semicolons (;) separating each extension.
When searching for an executable file, if there is no match on any extension, start checks to see if the name matches a directory name. If it does, start opens Explorer.exe on that path.
Examples
To start the Myapp program at the command prompt and retain use of the current Command Prompt window, type:
To view the start command-line help topic in a separate maximized Command Prompt window, type:
start start
Запускает отдельное окно командной строки для запуска указанной программы или команды. Starts a separate Command Prompt window to run a specified program or command.
Синтаксис Syntax
Параметры Parameters
Параметр Parameter | Описание Description |
---|---|
Задает заголовок, отображаемый в строке заголовка окна командной строки . Specifies the title to display in the Command Prompt window title bar. | |
/d |
. ]]
Комментарии Remarks
Вы можете запускать неисполняемые файлы с помощью сопоставления файлов, вводя имя файла в виде команды. You can run non-executable files through their file association by typing the name of the file as a command.
При выполнении команды, содержащей строку CMD в качестве первого маркера без квалификатора расширения или пути, команда CMD заменяется значением переменной COMSPEC. If you run a command that contains the string CMD as the first token without an extension or path qualifier, CMD is replaced with the value of the COMSPEC variable. Это не позволяет пользователям выбирать cmd из текущего каталога. This prevents users from picking up cmd from the current directory.
Если вы запускаете приложение с 32-битным графическим пользовательским интерфейсом (GUI), программа cmd не ждет завершения работы приложения, прежде чем вернуться в командную строку. If you run a 32-bit graphical user interface (GUI) application, cmd does not wait for the application to quit before returning to the command prompt. Такое поведение не происходит при запуске приложения из командного скрипта. This behavior does not occur if you run the application from a command script.
При выполнении команды, использующей первый токен, который не содержит расширение, Cmd.exe использует значение переменной среды ПАСЕКСТ, чтобы определить, какие расширения следует искать и в каком порядке. If you run a command that uses a first token that does not contain an extension, Cmd.exe uses the value of the PATHEXT environment variable to determine which extensions to look for and in what order. Значение по умолчанию для переменной ПАСЕКСТ: The default value for the PATHEXT variable is:
Обратите внимание, что синтаксис аналогичен переменной PATH с точкой с запятой (;) Отделение каждого расширения. Note that the syntax is the same as the PATH variable, with semicolons (;) separating each extension.
При поиске исполняемого файла, если нет совпадения с каким-либо расширением, запустите проверку, чтобы проверить, совпадает ли имя с именем каталога. When searching for an executable file, if there is no match on any extension, start checks to see if the name matches a directory name. Если это так, то Start открывает Explorer.exe по этому пути. If it does, start opens Explorer.exe on that path.
Примеры Examples
Чтобы запустить программу MyApp из командной строки и использовать текущее окно командной строки , введите: To start the Myapp program at the command prompt and retain use of the current Command Prompt window, type:
Чтобы просмотреть раздел справки по командной строке в отдельном окне командной строки с развернутым окном, введите: To view the start command-line help topic in a separate maximized Command Prompt window, type:
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
Default ODBC driver:
32-bit ODBC driver under 64-bit platform:
C:\windows\sysWOW64\odbcad32.exe
sysdm.cpl SystemProperties
or
sysdm.cpl DisplaySYSDMCPL
explorer.exe . Will open at the current directory
Windows Firewall with Advanced Security
wf.msc
(boot password.)
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”