Solved Run Exit/Quit?

MourningStar

(_x_)
Power User
VIP
Local time
3:42 PM
Messages
1,308
I know that doing a 'run pathname\programxyz.exe' will start a program. I would like to know what the command would be to exit/quit the program. Could it be something as simple as the same 'run' command with a '-quit' switch suffix?

thnx
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
HP (HP-P6212F)
OS
Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
CPU
Pentium(R) Dual-Core CPU E5300 @ 2.60GHz
Motherboard
PEGATRON CORPORATION Benicia
Memory
6.00 GB
Graphics Card(s)
Intel(R) G33/G31 Express Chipset Family
Sound Card
Realtek High Definition Audio
Monitor(s) Displays
24'' HP WS LCD
Screen Resolution
1920 x 1080 x 32 bits (4294967296 colors) @ 60 Hz
Hard Drives
(1) ATA Hitachi HDT72106 SCSI Disk Device (2) Generic- Compact Flash USB Device (3) Generic- MS/MS-Pro USB Device (4) Generic- SD/MMC USB Device (5) Generic- SM/xD-Picture USB Device (6) Verbatim STORE N GO USB Device
Keyboard
Logitech G510s
Mouse
Logitech Trackball M570
Antivirus
Microsoft Security Essentials / Malwarebytes
Browser
IE / Firefox / Chrome

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Dude Build
OS
Windows 10 Pro X64
CPU
Intel(R) Core(TM) i5-3570K CPU OC@ 4.5GHZ Turbo
Motherboard
MSI Z77A-G45 Gaming
Memory
8.00 GB DDR3 1600Mhz
Graphics Card(s)
MSI Gaming X GTX 1070
Sound Card
Realtek High Definition
Monitor(s) Displays
Dell S23O9W, HP L1710
Screen Resolution
DELL-1920 x 1080 HP-1280 x1024
Hard Drives
Crucial m4 256 SSD, WD 7200RPM 500GB WD 1TB
PSU
Seasonic X650 GOLD
Case
Zalman Z12
Cooling
Antec Kuhler 920
Keyboard
Logitech
Mouse
MSI DS100 Interceptor
Internet Speed
50 down and 5 up
Antivirus
MSE
Browser
Chrome, IE 11
Other Info
Logitech X-620 Speakers
I know that doing a 'run pathname\programxyz.exe' will start a program. I would like to know what the command would be to exit/quit the program. Could it be something as simple as the same 'run' command with a '-quit' switch suffix?
Have a look here

Microsoft Corporation
whoah, that page was greek to me.

So, given the 'sample' above, would it be :

taskkill pathname\programname.exe

?

edit : no, that didn't work :(
 
Last edited:

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
HP (HP-P6212F)
OS
Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
CPU
Pentium(R) Dual-Core CPU E5300 @ 2.60GHz
Motherboard
PEGATRON CORPORATION Benicia
Memory
6.00 GB
Graphics Card(s)
Intel(R) G33/G31 Express Chipset Family
Sound Card
Realtek High Definition Audio
Monitor(s) Displays
24'' HP WS LCD
Screen Resolution
1920 x 1080 x 32 bits (4294967296 colors) @ 60 Hz
Hard Drives
(1) ATA Hitachi HDT72106 SCSI Disk Device (2) Generic- Compact Flash USB Device (3) Generic- MS/MS-Pro USB Device (4) Generic- SD/MMC USB Device (5) Generic- SM/xD-Picture USB Device (6) Verbatim STORE N GO USB Device
Keyboard
Logitech G510s
Mouse
Logitech Trackball M570
Antivirus
Microsoft Security Essentials / Malwarebytes
Browser
IE / Firefox / Chrome
Hello MourningStar,

I started MS Paint and created a BAT file to kill the task with this command:
taskkill /IM mspaint.exe

The /IM parameter is for specifying the imagename (listed in Task Manager).
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
home built
OS
Multi-Boot W7_Pro_x64 W8.1_Pro_x64 W10_Pro_x64 +Linux_VMs +Chromium_VM
CPU
AMD Athlon II x4 620
Motherboard
Gigabyte GA-MA785G-UD3H
Memory
6GB GSkill DDR2 800
Graphics Card(s)
AMD 4670 GPU + AMD 4200 IGP
Sound Card
on board Realtek ALC889A
Monitor(s) Displays
RCA 40" LCD TV, Insignia 32" LCD TV, HP 15" LCD monitor
Screen Resolution
1680 x 1050
Hard Drives
OCZ Vertex 3 120GB,
Samsung F3 1TB (3),
Several others - WD, Seagate, Hitachi, ...
PSU
Corsair 500 W
Case
Rosewill mid tower
Cooling
CM 90mm rifle
Keyboard
Gyration wireless, Logitech wireless, Dell USB wired
Mouse
Gyration wireless, Logitech wireless, V7 USB wired
Internet Speed
Spectrum - 100Mbps D / 10Mbps U
Antivirus
Avast, MBAM3, EMET, WinPatrol
Browser
Pale Moon, Firefox, IE
Other Info
2 multi-boot PC's
Mainly HTPC/Office/Gen purpose (no gaming).
Trendnet USB KVM.
LG DVD burner/Blue Ray Player.
Tray system for removable SATA backup drives.

Not currently OCd, under-volted.
I use Hybrid sleep, rarely re-boot or shutdown.

Hauppauge HD-PVR, Avermedia PCIe TV Tuner, Hauppauge PCI TV Tuner.
thnx David - can you help me create that same .bat file so I can test it on my computer? I assume I would then type that file into the 'run' dialogue?
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
HP (HP-P6212F)
OS
Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
CPU
Pentium(R) Dual-Core CPU E5300 @ 2.60GHz
Motherboard
PEGATRON CORPORATION Benicia
Memory
6.00 GB
Graphics Card(s)
Intel(R) G33/G31 Express Chipset Family
Sound Card
Realtek High Definition Audio
Monitor(s) Displays
24'' HP WS LCD
Screen Resolution
1920 x 1080 x 32 bits (4294967296 colors) @ 60 Hz
Hard Drives
(1) ATA Hitachi HDT72106 SCSI Disk Device (2) Generic- Compact Flash USB Device (3) Generic- MS/MS-Pro USB Device (4) Generic- SD/MMC USB Device (5) Generic- SM/xD-Picture USB Device (6) Verbatim STORE N GO USB Device
Keyboard
Logitech G510s
Mouse
Logitech Trackball M570
Antivirus
Microsoft Security Essentials / Malwarebytes
Browser
IE / Firefox / Chrome
To add to what David already told you: Taskkill does not "quit" a program per se, it ends a process. To do it, it needs to know either the process ID (PID) or its process image name, quite often but not always the same than the name of the program's exe file.

An example. You have Windows Media Player running and want to stop it using Taskkill command. To do this you must first give the command (Taskkill), then using a so called switch to tell system if you will use the PID or process image name (/PID or /IM), and finally the respective PID or process image name.

You can find both process image name and PID using command prompt with command Taskklist or in Task Manager:
2013-08-13_173847.png

Notice that Task Manager does not show PIDs by default. To see the PIDs, use Task Manager's View Menu > Select Colums.

To stop Windows Media Player using Taskkill command and process image name:
taskkill /IM wmplayer.exe

Notice that the path is not required and should not be added, simply just the process name.

To stop Windows Media Player using Taskkill command and process ID:
taskkill /PID 2400

Kari
 
Last edited:

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
HP ENVY 17-1150eg
OS
Windows 10 Pro x64 EN-GB
CPU
1.6 GHz Intel Core i7-720QM Processor
Memory
6 GB
Graphics Card(s)
ATI Mobility Radeon HD 5850 Graphics
Sound Card
Beats sound system with integrated subwoofer
Monitor(s) Displays
17" laptop display, 22" LED and 32" Full HD TV through HDMI
Screen Resolution
1600*900 (1), 1920*1080 (2&3)
Hard Drives
Internal: 2 x 500 GB SATA Hard Disk Drive 7200 rpm
External: 2TB for backups, 3TB USB3 network drive for media
Cooling
As Envy runs a bit warm, I have it on a Cooler Master pad
Keyboard
Logitech diNovo Media Desktop Laser (bluetooth)
Mouse
Logitech Performance Mouse MX
Internet Speed
50/10 Mbps VDSL
Antivirus
Windows Defender 4.3.9431.0
Browser
Maxthon 3.5.2., IE11
Thank you Kari. I just learned that there also exists a 'kill' command. Is it same?
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
HP (HP-P6212F)
OS
Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
CPU
Pentium(R) Dual-Core CPU E5300 @ 2.60GHz
Motherboard
PEGATRON CORPORATION Benicia
Memory
6.00 GB
Graphics Card(s)
Intel(R) G33/G31 Express Chipset Family
Sound Card
Realtek High Definition Audio
Monitor(s) Displays
24'' HP WS LCD
Screen Resolution
1920 x 1080 x 32 bits (4294967296 colors) @ 60 Hz
Hard Drives
(1) ATA Hitachi HDT72106 SCSI Disk Device (2) Generic- Compact Flash USB Device (3) Generic- MS/MS-Pro USB Device (4) Generic- SD/MMC USB Device (5) Generic- SM/xD-Picture USB Device (6) Verbatim STORE N GO USB Device
Keyboard
Logitech G510s
Mouse
Logitech Trackball M570
Antivirus
Microsoft Security Essentials / Malwarebytes
Browser
IE / Firefox / Chrome
Taskkill is everything you need to kill processes using command prompt.

Kill is a far more complicated PowerShell command to call (run) a cmdlet called Stop-Process and as such not recognized by or usable in command prompt. Basically it does nothing more than Taskkill.
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
HP ENVY 17-1150eg
OS
Windows 10 Pro x64 EN-GB
CPU
1.6 GHz Intel Core i7-720QM Processor
Memory
6 GB
Graphics Card(s)
ATI Mobility Radeon HD 5850 Graphics
Sound Card
Beats sound system with integrated subwoofer
Monitor(s) Displays
17" laptop display, 22" LED and 32" Full HD TV through HDMI
Screen Resolution
1600*900 (1), 1920*1080 (2&3)
Hard Drives
Internal: 2 x 500 GB SATA Hard Disk Drive 7200 rpm
External: 2TB for backups, 3TB USB3 network drive for media
Cooling
As Envy runs a bit warm, I have it on a Cooler Master pad
Keyboard
Logitech diNovo Media Desktop Laser (bluetooth)
Mouse
Logitech Performance Mouse MX
Internet Speed
50/10 Mbps VDSL
Antivirus
Windows Defender 4.3.9431.0
Browser
Maxthon 3.5.2., IE11
^
Thnx again Kari - (o.t. just noticed your stats, I've been a serious Nightwish fan since their beginnings.)
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
HP (HP-P6212F)
OS
Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
CPU
Pentium(R) Dual-Core CPU E5300 @ 2.60GHz
Motherboard
PEGATRON CORPORATION Benicia
Memory
6.00 GB
Graphics Card(s)
Intel(R) G33/G31 Express Chipset Family
Sound Card
Realtek High Definition Audio
Monitor(s) Displays
24'' HP WS LCD
Screen Resolution
1920 x 1080 x 32 bits (4294967296 colors) @ 60 Hz
Hard Drives
(1) ATA Hitachi HDT72106 SCSI Disk Device (2) Generic- Compact Flash USB Device (3) Generic- MS/MS-Pro USB Device (4) Generic- SD/MMC USB Device (5) Generic- SM/xD-Picture USB Device (6) Verbatim STORE N GO USB Device
Keyboard
Logitech G510s
Mouse
Logitech Trackball M570
Antivirus
Microsoft Security Essentials / Malwarebytes
Browser
IE / Firefox / Chrome
You are welcome. I liked Nightwish when Anette Olzon was still with them but somehow lost interest after she left the band (was kicked out). What an incredible voice she has!
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
HP ENVY 17-1150eg
OS
Windows 10 Pro x64 EN-GB
CPU
1.6 GHz Intel Core i7-720QM Processor
Memory
6 GB
Graphics Card(s)
ATI Mobility Radeon HD 5850 Graphics
Sound Card
Beats sound system with integrated subwoofer
Monitor(s) Displays
17" laptop display, 22" LED and 32" Full HD TV through HDMI
Screen Resolution
1600*900 (1), 1920*1080 (2&3)
Hard Drives
Internal: 2 x 500 GB SATA Hard Disk Drive 7200 rpm
External: 2TB for backups, 3TB USB3 network drive for media
Cooling
As Envy runs a bit warm, I have it on a Cooler Master pad
Keyboard
Logitech diNovo Media Desktop Laser (bluetooth)
Mouse
Logitech Performance Mouse MX
Internet Speed
50/10 Mbps VDSL
Antivirus
Windows Defender 4.3.9431.0
Browser
Maxthon 3.5.2., IE11
Back
Top