检查已安装软件的注册表项& Token,Delim解释

时间:2015-08-13 13:50:37

标签: batch-file scripting token delimiter registrykey

我一直在这个网站上阅读并找到了很好的信息,但我仍然对下面的脚本如何工作有点困惑?我一直在检查我需要的部分的脚本,但我对此很新,我仍然不确定如何做到这一点。我相信"代币"是管理员权利,以检索您需要的信息和" Delims"是什么将您拥有的列表中的计算机名称列表(文本文件)?

我需要查看我的文本文件,我使用dsquery在AD中的某些OU中检索计算机名称并将它们放在文本文件中。我想ping PC以确保它&# 39;然后检查特定的注册表项以确认已完成的安装数量和未完成的数量。 这就是我到目前为止所做的:

@echo off

if %USERNAME% NEQ XXXXX (
echo.
echo   THE ACCOUNT YOU ARE USING IS NOT AUTHORIZED TO RUN THIS SCRIPT.
echo.
echo        Logoff and back on with the correct account.
echo.
pause
goto:eof
)
set _date=14Aug2015
set _version=Shockwave12.1.9.150

:infile
REM Specify PC Query List
REM Query list must be a text file (filename.txt)
REM Query filename can be set manually:
cls
echo.
echo Account running this script must have administrator priviledges on remote machines.
echo.
echo Enter the filename only not the extension. (i.e querylist)  
echo.
set inputfile=
set /p inputfile=Enter the Query list file name:

if not exist %inputfile%.txt goto :infile
echo.
echo.

title "Shockwave 12.1.9.150" %inputfile%

:dlbchk
REM Double check
cls
echo.
echo Last chance to re-enter list and time...
echo.
echo You have chosen to check the registry on the machines on this Query list '%inputfile%.txt'
echo.
set inputchk=
set /p inputchk=To continue press 'Y' and To Quit press 'Q' :

if "%inputchk%" == "Y" goto :output
if "%inputchk%" == "y" goto :output
if "%inputchk%" == "Q" goto:eof
if "%inputchk%" == "q" goto:eof
goto :infile

:output
REM Check for Adobe Shockwave Player 12.1.9.159 - {699025AA-475E-45F2-9C9B-9A489CAD2C10}
for /f "tokens=1" %%i in (%inputfile%.txt) do call :pingtest %%i
echo. >> %logfile%
goto:eof
REG QUERY "\\%1\HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{699025AA-475E-45F2-9C9B-9A489CAD2C10}
IF %errorlevel%=="0" Echo %1 >> \\Server\Share\Shockwave\Shockwave 12.1.9.159\Installed.txt
IF %errorlevel%=="1" Echo %1 >> \\Server\Share\Shockwave\Shockwave 12.1.9.159\NotInstalled.txt

:pingtest
REM Check if device is available
echo. >> %logfile%
ping -w 500 -n 1 %1>nul  
if errorlevel 1 (
echo %1,offline >> %logfile%
goto:eof
)

0 个答案:

没有答案