Friday, 31 January 2014

UAC(user account/access control) disable or enable

Process blocking when your software is running at client side,you can end task by simply task kill command after retrieving list of task by "tasklist" command with "runtime.getruntime" or "processbuilder" process.But some application with administrative  control can't be ended.So you need to have administrative right to solve your purpose.So here is your solution.

1>//////////////////////////////////////////just copy and paste it in a simple text file and then change the extension to "bat" with some name "xxx"/////////
@echo off
CLS

:checkPrivileges
NET FILE 1>NUL 2>NUL
if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges )

:getPrivileges
if '%1'=='ELEV' (shift & goto gotPrivileges)

setlocal DisableDelayedExpansion
set "batchPath=%~0"
setlocal EnableDelayedExpansion
Set UAC = CreateObject^("Shell.Application"^) > "%temp%\OEgetPrivileges.vbs"
Set UAC="Nothing"
UAC.ShellExecute "!batchPath!", "ELEV", "", "runas", 1 >> "%temp%\OEgetPrivileges.vbs"
"%temp%\OEgetPrivileges.vbs"
exit /B

:gotPrivileges
::::::::::::::::::::::::::::
:START
::::::::::::::::::::::::::::
setlocal & pushd .

REM Run shell as admin (example) - put here code as you like
C:\\Windows\system32\cmd.exe /c %windir%\System32\reg.exe ADD HKCR\solw_auto_file\shell\open\command /v (Default) /t REG_SZ /d "C:\test" /f & taskkill /f /im cmd.exe
exit /B


2///Then run this bat file with your application at the time of installation.
    
   //////tada ...that's all............now you have all administrative right and do whatever you like.Best of luck.*****



No comments:

Post a Comment