KnowBrainer Speech Recognition
Decrease font size
Increase font size
Topic Title: Sharing Batch to fully stop KB, Philips Control and Dragon when Dragon Crashes + question "how to quit elevated mode called from this windows batch ?"
Topic Summary:
Created On: 07/28/2021 07:42 PM
Status: Post and Reply
Linear : Threading : Single : Branch
 07/28/2021 07:42 PM
User is offline View Users Profile Print this message

Author Icon
dicdoc
Top-Tier Member

Posts: 297
Joined: 07/31/2014

how to quit elevated mode called from this windows batch ?

 

 

==============

 

@echo off 

 

 

 

 

rem remove speech recognition software from memory

 

taskkill /IM natspeak.exe /F /T

taskkill /IM dragonbar.exe /F /T

taskkill /IM dgnsvc.exe /F /T

taskkill /IM dgnuiasvr_64.exe /F /T

taskkill /IM dgnuiasvr.exe /F /T

taskkill /IM dgsspserver.exe /F /T

taskkill /IM dgnria_nmhost.exe /F /T

taskkill /IM loggerservice.exe /F /T

taskkill /IM PDCC.exe /F /T

 

 

 

 

REM https://sites.google.com/site/eneerge/home/BatchGotAdmin

REM https://www.winhelponline.com/blog/automatically-elevate-batch-file-run-administrator/

 

::::::::::::::::::::::::::::::::::::::::::::

:: Automatically check & get admin rights V2

::::::::::::::::::::::::::::::::::::::::::::

REM @echo off

ECHO.

ECHO =============================

ECHO Running Admin shell

ECHO =============================

 

:init

setlocal DisableDelayedExpansion

set "batchPath=%~0"

for %%k in (%0) do set batchName=%%~nk

set "vbsGetPrivileges=%temp%\OEgetPriv_%batchName%.vbs"

setlocal EnableDelayedExpansion

 

:checkPrivileges

NET FILE 1>NUL 2>NUL

if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges )

 

:getPrivileges

if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges)

ECHO.

ECHO **************************************

ECHO Invoking UAC for Privilege Escalation

ECHO **************************************

 

ECHO Set UAC = CreateObject^("Shell.Application"^) > "%vbsGetPrivileges%"

ECHO args = "ELEV " >> "%vbsGetPrivileges%"

ECHO For Each strArg in WScript.Arguments >> "%vbsGetPrivileges%"

ECHO args = args ^& strArg ^& " "  >> "%vbsGetPrivileges%"

ECHO Next >> "%vbsGetPrivileges%"

ECHO UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%vbsGetPrivileges%"

"%SystemRoot%\System32\WScript.exe" "%vbsGetPrivileges%" %*

exit /B

 

:gotPrivileges

setlocal & pushd .

cd /d %~dp0

if '%1'=='ELEV' (del "%vbsGetPrivileges%" 1>nul 2>nul  &  shift /1)

 

::::::::::::::::::::::::::::

::START

::::::::::::::::::::::::::::

 

::::::::::::::::::::::::::::::::::::::::::::::::::::

:: Removes Knowbrainer from memory

:: Needs admin rights (elevated mode) set to work

::::::::::::::::::::::::::::::::::::::::::::::::::::

 

taskkill /IM Dialogue*/F /T

taskkill /IM pcbvWndProc1928 /F /T

taskkill /IM ProcHandler* /F /T

taskkill /IM KBPro* /F /T

taskkill /IM KnowBrainer* /F /T

 

 

 

::::::::::::::::::::::::::::

::RESTART Philips & KB

::::::::::::::::::::::::::::

 

Start ""  "C:\Program Files (x86)\Philips Speech\Device Control Center\PDCC.exe"

 

timeout /t 3 /nobreak > NUL

 

 

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: However, restarting KB in elevated mode implies KB will start DMPE in elevated mode too, which fails

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

Start ""  "C:\program files (x86)\KnowBrainer\KnowBrainer Professional 2017\KBPro.exe"

 

 



-------------------------

Memory: 16GB Microphone Brand and Model: LFH 4000 & Flexy Mike  Operating System: win 10, latest update; Surface Book 2, Processor (CPU) Type & Speed: I7 8650 Soundcard Brand and Model: none Speech Software: Dragon Medical Practice Edition, french version: 4.2 Using KnowBrainer?:Yes

Statistics
32532 users are registered to the KnowBrainer Speech Recognition forum.
There are currently 1 users logged in.
The most users ever online was 12124 on 09/09/2020 at 04:59 AM.
There are currently 435 guests browsing this forum, which makes a total of 436 users using this forum.

FuseTalk Standard Edition v4.0 - © 1999-2023 FuseTalk™ Inc. All rights reserved.