I have Bluetooth headphone, sometimes windows 10 fails to connect with Bluetooth device so I need to go to task manager -> Services – Open Services -> Find Bluetooth Support Service and restart it.
I was curious if I can make any shortcut or batch file operation or kind of script and I can just click on it and it will restart Bluetooth Support Service.
First, find your service name by typing this command:
powershell -Command "sc.exe query | Select-String -Pattern Bluetooth -Context 1,0"
You’ll find your service’s name with the string
SERVICE_NAME just above the
DISPLAY_NAME you searched for. It can be something like
Then, in an ELEVATED command prompt, type these two commands:
sc stop YourServiceNameFoundAbove sc start YourServiceNameFoundAbove
Your service is now restarted.
You can use the following batch, it will ask automatically for elevation if needed.
Just modify the line
set SRV=... and save it where it suits you, then you simply need to create a shortcut manually (done only once) on your desktop.
@echo off setlocal EnableExtensions EnableDelayedExpansion set SRV=YourServiceNameFoundPreviously REM Check admin mode, auto-elevate if required. openfiles > NUL 2>&1 || ( REM Not elevated. Do it. echo createObject^("Shell.Application"^).shellExecute "%~dpnx0", "%*", "", "runas">"%TEMP%\%~n0.vbs" cscript /nologo "%TEMP%\%~n0.vbs" goto :eof ) del /s /q "%TEMP%\%~n0.vbs" > NUL 2>&1 sc stop !SRV! || ( echo ERROR: Couldn't stop service !SRV!. pause goto :eof ) sc start !SRV! || ( echo ERROR: Couldn't start service !SRV!. pause goto :eof ) goto :eof
Answered By – Wisblade
Answer Checked By – Senaida (BugsFixing Volunteer)