Skip to content

Commit 23f5a2f

Browse files
authored
Added full PATH scanning
1 parent 9ed1881 commit 23f5a2f

File tree

1 file changed

+41
-11
lines changed

1 file changed

+41
-11
lines changed

amdocl.bat

Lines changed: 41 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,50 @@ echo By Patrick Trumpis (https://github.com/ptrumpis/OpenCL-AMD-GPU)
44
echo Inspired by https://stackoverflow.com/a/28407851
55
echo:
66

7-
%SYSTEMDRIVE%
8-
cd %SYSTEMROOT%
9-
cd system32
7+
>nul 2>&1 "%SYSTEMROOT%\System32\cacls.exe" "%SYSTEMROOT%\System32\config\system" && (
8+
goto :run
9+
) || (
10+
echo Execution stopped
11+
echo ==================
12+
echo This script requires administrator rights.
13+
echo Please run it again as administrator.
14+
echo You can right click the file and select 'Run as administrator'
1015

16+
echo:
17+
pause
18+
exit /b 1
19+
)
20+
21+
:run
1122
SET ROOTKEY=HKEY_LOCAL_MACHINE\SOFTWARE\Khronos\OpenCL\Vendors
1223

1324
SETLOCAL EnableDelayedExpansion
14-
FOR /r %%x IN (*amdocl*dll) DO (
15-
SET FILE="%%x"
16-
reg add %ROOTKEY% /v %%x /t REG_DWORD /d 0 /f
17-
18-
IF !ERRORLEVEL! == 0 (
19-
echo Added: !FILE!
20-
echo:
21-
)
25+
26+
echo Now scanning your PATH for amdocl.dll files, please wait...
27+
echo:
28+
29+
for %%a in ("%path:;=";"%") do (
30+
if "%%~a" neq "" (
31+
cd /D %%a
32+
for /r %%f in (*amdocl*dll) do (
33+
set FILE="%%~dpnxf"
34+
echo Found: !FILE!
35+
36+
reg query %ROOTKEY% /v !FILE! >nul 2>&1
37+
38+
if not !ERRORLEVEL! == 0 (
39+
reg add %ROOTKEY% /v !FILE! /t REG_DWORD /d 0 /f
40+
41+
IF !ERRORLEVEL! == 0 (
42+
echo Added: !FILE!
43+
)
44+
)
45+
)
46+
)
2247
)
48+
49+
echo:
50+
echo Done.
51+
echo:
2352
pause
53+
exit /b 0

0 commit comments

Comments
 (0)