-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy paththai_pnd_program_fix.bat
More file actions
103 lines (92 loc) · 2.91 KB
/
thai_pnd_program_fix.bat
File metadata and controls
103 lines (92 loc) · 2.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
@echo off
setlocal enableDelayedExpansion
REM check Administrator privileges
net session >nul 2>&1
if %ERRORLEVEL% EQU 0 (
echo ----- Administrator PRIVILEGES Detected! -----
goto :start
) else (
echo ##########################################################
echo.
echo.
echo ######## ######## ######## ####### ########
echo ## ## ## ## ## ## ## ## ##
echo ## ## ## ## ## ## ## ## ##
echo ###### ######## ######## ## ## ########
echo ## ## ## ## ## ## ## ## ##
echo ## ## ## ## ## ## ## ## ##
echo ######## ## ## ## ## ####### ## ##
echo.
echo.
echo ####### ERROR: ADMINISTRATOR PRIVILEGES REQUIRED #########
echo This script must be run as administrator to work properly!
echo If you're seeing this after clicking on a start menu icon,
echo then right click on the shortcut and select "Run As Administrator".
echo ##########################################################
echo.
pause
goto :eof
)
:start
REM set OS variables
reg Query "HKLM\Hardware\Description\System\CentralProcessor\0" | find /i "x86" > nul && set OS=32BIT || set OS=64BIT
if %OS%==64BIT (
set systemPath="C:\Windows\SysWOW64"
set pndPath="%ProgramFiles(x86)%\Rdinet"
echo ----- Using 64bit operating system -----
)
if %OS%==32BIT (
set systemPath="C:\Windows\System32"
set pndPath="%ProgramFiles%\Rdinet"
echo ----- Using 32bit operating system -----
)
REM get install PND program list
set /a pndLen=0
for /f %%G in ('dir %pndPath% /b') do (
set pnd[!pndLen!]=%%~G
set /a pndLen+=1
)
REM loop through install PND program
set k=0
:loop_PND_program
if %k% equ %pndLen% (
goto :finish
)
for /f "usebackq delims== tokens=2" %%k in (`set pnd[%k%]`) do (
echo ----- %%k Program -----
REM get file DLL and OSX from PND program
cd "%pndPath:"=%\%%k"
set /a count=0
for /f %%G in ('dir *.ocx *.dll /b') do (
REM loop through file found in PND program
if exist "%systemPath:"=%\%%~G" (
echo %%~G already exist
) else (
echo --- Copy %%~G to system
echo N | xcopy "%pndPath:"=%\%%k\%%~G" %systemPath%
echo --- Register %%~G to system
regsvr32 %systemPath:"=%\%%~G"
)
set /a count+=1
set fileName[!count!]=%%~G
)
)
set /a k=%k%+1
goto :loop_PND_program
:finish
echo ##########################################################
echo.
echo.
echo ######## ####### ## ## ########
echo ## ## ## ## ### ## ##
echo ## ## ## ## #### ## ##
echo ## ## ## ## ## ## ## ######
echo ## ## ## ## ## #### ##
echo ## ## ## ## ## ### ##
echo ######## ####### ## ## ########
echo.
echo.
echo ##########################################################
echo.
pause
goto :eof