Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.

Windows 7: Clickable service start/stop cmd or bat file. Possible?

08 Nov 2010   #1
Holy Moses

Windows 7 Professional 32-bit///Vista Home Premium 32-bit
Clickable service start/stop cmd or bat file. Possible?

Not sure if I labelled this post right, or if I am even posting this in the right category/forum.

If admins could direct this if need be, that would be cool.

What I would like to do is have some kind of .cmd or .bat file that will turn on or restart my PS3 Media Server service, just by clicking it.
Maybe one that stops the service as well, or even one that can restart it.

I currently have a shortcut to services on the desktop, but it can be annoying when I have to restart the server numerous times because of various issues, and I have to scroll thru all the services, find PS3 Media Serve service, right click, restart.
When I start PS3 Media server as a task (so you can see the GUI), with the .exe file, you simply save your settings, hit Quit, then click the .exe on the desktop and VOILA, settings saved, and server restarted.

With the service installed and enabled, you can't quickly access the GUI and see your buffer or other values as running two instances of javaw.exe makes things go all screwy.

So, with the service, in order to change settings, I have to disable the service, then click the PMS.exe on my desktop so that PMS opens as a task. I then change any settings, save them, quit the GUI, then open services, and restart the service.
And the "restart http server" option has been broke for some time now. There are so many issues right now with PMS that many people don't want the extra headache of solving service issues, and most use a shortcut copy of their .exe in their shell:startup folder.

I figure if I can have some kind of quick way to make the service stop, click the .exe, do my thing with settings in the GUI (task startup), then close and click something to make the service start again.

I know this sounds like I am being lazy, but if someone could point me in the right direction on how to do this, my serving world would be greatly improved.

First off is this possible? Second, where and what would I even look up. Creating working .cmd or .bat files is WAAAY out of my league. I have learned how to edit some in PMS for Java heap settings to maximize my buffer capacity, but starting/creating such an option is beyond me.

If anyone needs anymore info, glad to give it. I asked a while back in the forums over there, but my thread got overlooked, and I find that stuff like this is better left to....well.....the pros.

Any ideas, and thanks in advance. Looking forward to learning something new.

My System SpecsSystem Spec
08 Nov 2010   #2

Windows 10 Pro x64 x2 Windows 10 Enterprise x64, Ubuntu

You can use the netsh tool (netsh.exe) to automate the control of services - add a suitably edited batch file or even a scheduled task, to run the following ...

As admin.

start a service:
Net start service_name

stop a service:
Net stop service_name

or as user or admin

Pausing a service:
Net pause service_name

Resuming a service:
Net continue service_name

To crate the Bat file

create a new text document - and add the command above on a separate line
save the .txt file

Rename the text file to have a bat extension
you will get a warning that changing an extension is not a good idea, but in this instance it is OK
My System SpecsSystem Spec
08 Nov 2010   #3
Orbital Shark


Also, you will need to have 'Hide extensions of all known file types' unchecked too in order to change the extension.

Name:  Capture.PNG
Views: 19
Size:  46.3 KB
Tip   Tip
Explorer -> 'Organize' -> 'Folder and Search options' -> View


My System SpecsSystem Spec

08 Nov 2010   #4
Holy Moses

Windows 7 Professional 32-bit///Vista Home Premium 32-bit

Cool, I will give this a try and let you know how I make out. Hope it works, thank you very much Nigel.

EDIT: and thank you to Orbital Shark, good point, though I already have file extensions visible. But this will hopefully help others who might want to do this, so thank you.
My System SpecsSystem Spec
08 Nov 2010   #5

Microsoft Community Contributor Award Recipient


To add to that what Nigel told:

Command net stop service_name stops the named service, net start service_name starts itas Nigel mentioned. When you have saved it as a batch-file with extension .bat, you can not run it by double clicking because to start or stop services, you need built-in administrator rights. The option Run as administartor is grayed out in batch file properties, it can not be chosen. You can run the batch to start or stop a service only by right clicking it and choosing Run as administrator from context menu.

Name:  BatchProperties.png
Views: 30
Size:  46.4 KB

A simple workaround is to create a shortcut to that batch file. Also in Shortcut properties is the option Run as administrator grayed out, if you look the Compability tab. But shortcut properties also has a Shortcut tab, where you can choose Advanced and surprise surprise, another place to choose run as administrator.


Now you can double click the shortcut to run your batch files as administrator. UAC still prompts asking are you sure, but at least you don't have to run your batch from context menus, simple double click and telling UAC "yes, I'm sure" is enough.

Name:  Capture.PNG
Views: 53
Size:  17.0 KB

If using notepad, remember to choose Save as type All files to avoid otherwise automatically added .txt file extension, and add the .bat extension to the file name.



My System SpecsSystem Spec
08 Nov 2010   #6
Holy Moses

Windows 7 Professional 32-bit///Vista Home Premium 32-bit

Ok. I tried to stop the service via the command line in netsh>

I entered :

net stop PS3 Media Server

Reply: The following command was not found: net stop PS3 Media Server

I then tried:

net stop PS3_Media_server (because of the way you wrote your description)

Reply: same as before.

Am I doing something inherently wrong here? I have started and stopped a service or two with this method ( I am pretty sure) but it was a while back.

I could try doing the .txt file do .bat thing and enter the values, but I figured if I can't get it to do it at the command line, I must not have it correct, and making a .bat file would be a waste of time. Please tell me it is something silly and easy to remedy.

EDIT: @ Kari......Thanks for that tip to enable double click. Now, I run the hidden admin account, or super admin, whatever the hell it is called. I have UAC disabled and never have admin issues and don't see those annoying pop up, "are you sure" windows......only with permissions if I unplug a HDD or move an already shared folder or something then my admin rights can be jeopardized.

I know UAC is there for a reason, but I just have to have it disabled. It just drives me nuts.

Definitely a cool workaround, if I can figure out the proper syntax, or line command....whatever it would be referred to as.
My System SpecsSystem Spec
08 Nov 2010   #7
Orbital Shark


You run net stop and net start from command prompt (as administrator).

The syntax you need is net stop "ps3 media server". By adding the " you're telling it to look for the string value name of the service.

Name:  Capture.PNG
Views: 170
Size:  46.8 KB

My System SpecsSystem Spec
08 Nov 2010   #8

Windows 7 x64 pro/ Windows 7 x86 Pro/ XP SP3 x86


net stop "PS3 Media Server"
net start "PS3 Media Server"
My System SpecsSystem Spec
08 Nov 2010   #9
Holy Moses

Windows 7 Professional 32-bit///Vista Home Premium 32-bit

Quote   Quote: Originally Posted by Orbital Shark View Post
You run net stop and net start from command prompt (as administrator).

The syntax you need is net stop "ps3 media server". By adding the " you're telling it to look for the string value name of the service.

Attachment 112139
Bingo! I don't remember having to add the quotes, but that did it. Immediately, my server disconneted, then reconnected with the start command.

Also was doing it from the netsh> line. Probably not right either.

but now I feel confident in it working. Thank you to ALL!

Very cool info, and you guys amaze me how fast you recall this info when needed. AWESOME.

Cheers, you have just added the cherry on top for my server now. I don't think I can tweak it any better than it is now. Well!!!
My System SpecsSystem Spec
08 Nov 2010   #10
Orbital Shark


Thanks for your kind words and we're always glad to help

Please enjoy the rest of the forums
My System SpecsSystem Spec

 Clickable service start/stop cmd or bat file. Possible?

Thread Tools

Similar help and support threads
Thread Forum
Batch file to start a service if the service is not running
Here what I want : if servicename is running, do nothing. if servicename is not running, then start servicename, then record the date and time. based on my search online, here is what I have so far: net start | find "servicename" > nul 2>&1
General Discussion
Unable to start .jar file as a window service
Hello Everyone, This is my 1st thread, so i'm naive about the categories under which the issue i'm facing falls. I've a jar file which contains a very simple program of displaying "Hello" message in the console.I've pasted the code at the end of this thread.I want to run this jar file as a...
Can I stop the 'WLAN Autoconfig Service'
Good evening, This is actually a follow-up to a previous post ( I had in this forum but since I marked that one 'solved' I figured it would be best to start a new thread. In that thread I was...
Network & Sharing
services start/stop or change from autostart to demand start
My brand new Dell laptop keeps losing its active window focus. I have tried to pinpoint the problem to a service or startup and did not find anything specific. I am now checking the System logs and I see things like : The Windows Modules Installer Service changes every couple of seconds its...
General Discussion
Start Menu Item's Arrow ONLY Clickable
When I open the start menu and mouseover an item that has a right facing arrow, it automatically opens up the Recent Items pane on the right side. I don't want it to open upon mouseover, but only on-click. Is this tweak possible? ...
General Discussion

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 00:27.

Twitter Facebook Google+

Windows 7 Forums

Seven Forums Android App Seven Forums IOS App