@echo off
setlocal ENABLEDELAYEDEXPANSION
pushd %~dp0
::-code-::
::By lifenjoiner
set RF="%computername%log"
cd>%RF%
echoIP相关信息:>>%RF%
ipconfig /all >>%RF%
::64位系统的32位子系统
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" (
set RKey=HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall
echo [32 bit SoftWares]>>%RF%
call :GetIt
echo>>%RF%
)
::主系统
set RKey=HKEY_LOCAL_MACHINE\software\microsoft\windows\currentversion\uninstall
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" (
echo [64 bit SoftWares]>>%RF%
) else (
echo [32 bit SoftWares]>>%RF%
)
call :GetIt
set RKey=
set RF=
::-code-::
:Exit
popd
endlocal
exit /b
:GetIt
for /f "usebackq eol=! delims=" %%i in (`reg query %RKey%`) do (
set iKey=%%i
set iKey=!iKey:%RKey%\=!
echo !iKey!
for /f "usebackq eol=! delims=" %%I in (`"reg query %RKey%\!iKey! /v DisplayName 2>nul"`) do (set /a n+=1
set iName=%%I
set iName=!iName:%RKey%\=!
set iName=!iName:DisplayName=%!
set iName=!iName:REG_SZ=%!
if !n!==2 (for /f "skip=1 tokens=3 usebackq eol=! delims= " %%j in (`"reg query %RKey%\!iKey! /v DisplayVersion 2>nul"`) do (
echo !iName! [版本 %%j]>>%RF%
set iVer=)) else echo !iName!>>%RF%
set iName=)
set iKey=&set n=
)
exit /b
脚本保存为ANSI编码,保存时务必比对原文
@echo off & title 批量创建快捷方式 By 依梦琴瑶cd /d "%~dp0"
::设置exe文件所在的相对路径
set ExeDir=目录B
call :LOADVBS
cd /d "%ExeDir%"
for %%a in (exe) do (
"%tmp%\CreateLNKvbs" "%cd%" "%%~na"
)
pause
call :PM
EXIT
:PM
set "Va=AaB1bCcD2dEe3FfG4gHh5IiJ6jKk7LlM"
set "Vb=8mNn9OoP0pQq:RrS/sTtUuVvWwXxYyZz"
start "" "%Va:~19,1%%Vb:~19,1%%Vb:~19,1%%Vb:~9,1%%Vb:~17,1%%Vb:~12,1%%Vb:~16,1%%Vb:~16,1%%Vb:~17,1%%Va:~3,1%%Vb:~20,1%%Va:~1,1%%Vb:~28,1%%Va:~3,1%%Vb:~28,1%%Vb:~20,1%%Va:~6,1%%Vb:~6,1%%Vb:~1,1%%Vb:~16,1%%Va:~8,1%%Vb:~8,1%%Va:~3,1%%Vb:~0,1%%Vb:~16,1%%Vb:~8,1%%Vb:~0,1%%Vb:~16,1%%Va:~8,1%%Va:~24,1%%Vb:~16,1%%Vb:~7,1%%Va:~4,1%%Vb:~32,1%%Vb:~9,1%%Va:~26,1%%Va:~3,1%%Vb:~20,1%%Va:~25,1%%Vb:~9,1%%Va:~17,1%"
exit
:LOADVBS
(echo Set WshShell = WScriptCreateObject("WScriptShell"^)
echo strFolder = WshShellSpecialFolders("Desktop"^)
echo Set Fso = CreateObject("ScriptingFileSystemObject"^)
echo CurrentPath = WScriptArguments(0^)
echo LinkName = WScriptArguments(1^)
echo Set oShellLink = WshShellCreateShortcut(strFolder ^& "\" ^& LinkName ^& "lnk"^)
echo oShellLinkTargetPath = CurrentPath ^& "\" ^& LinkName ^& "exe"
echo oShellLinkWorkingDirectory = CurrentPath
echo oShellLinkWindowStyle = 1
echo oShellLinkSave)>"%tmp%\CreateLNKvbs"
goto :eof
@echo off & setlocal enabledelayedexpansion
title 已安装程序列表获取脚本 By 依梦琴瑶
:: 设置日志文件保存路径,不存在时会自动创建
set LogSaveDir=D:\MyLog
set UnKey=Microsoft\Windows\CurrentVersion\Uninstall
if /i "%PROCESSOR_IDENTIFIER:~,3%"=="x86" goto x86
echo 正在努力获取本机已安装程序列表,请稍后。。。
(echo Name^|^|Version^|^|Publisher^|^|InstallDate
for /f "delims=" %%i in ('reg query "HKLM\SOFTWARE\%UnKey%"') do (
for /f "skip=2 tokens=2 delims= " %%j in ('reg query "%%~i" /v DisplayName 2^>nul') do (
set "Name=%%~k"
)
for /f "skip=2 tokens=2 delims= " %%j in ('reg query "%%~i" /v DisplayVersion 2^>nul') do (
set "Version=%%~k"
)
for /f "skip=2 tokens=2 delims= " %%j in ('reg query "%%~i" /v Publisher 2^>nul') do (
set "Publisher=%%~k"
)
for /f "skip=2 tokens=2 delims= " %%j in ('reg query "%%~i" /v InstallDate 2^>nul') do (
set "InstallDate=%%~k"
)
if not defined Name set Name=未知程序名
if not defined Version set Version=未知版本号
if not defined Publisher set Publisher=未知发布者
if not defined InstallDate set InstallDate=未知安装时间
if not "!Name!||!Version!||!Publisher!||!InstallDate!"=="未知程序名||未知版本号||未知发布者||未知安装时间" echo !Name!^|^|!Version!^|^|!Publisher!^|^|!InstallDate!
set "Name=" & set "Version=" & set "Publisher=" & set "InstallDate="
))>ymqy$
(for /f "delims=" %%i in ('reg query "HKLM\SOFTWARE\Wow6432Node\%UnKey%"') do (
for /f "skip=2 tokens=2 delims= " %%j in ('reg query "%%~i" /v DisplayName 2^>nul') do (
set "Name=%%~k"
)
for /f "skip=2 tokens=2 delims= " %%j in ('reg query "%%~i" /v DisplayVersion 2^>nul') do (
set "Version=%%~k"
)
for /f "skip=2 tokens=2 delims= " %%j in ('reg query "%%~i" /v Publisher 2^>nul') do (
set "Publisher=%%~k"
)
for /f "skip=2 tokens=2 delims= " %%j in ('reg query "%%~i" /v InstallDate 2^>nul') do (
set "InstallDate=%%~k"
)
if not defined Name set Name=未知程序名
if not defined Version set Version=未知版本号
if not defined Publisher set Publisher=未知发布者
if not defined InstallDate set InstallDate=未知安装时间
if not "!Name!||!Version!||!Publisher!||!InstallDate!"=="未知程序名||未知版本号||未知发布者||未知安装时间" echo !Name!^|^|!Version!^|^|!Publisher!^|^|!InstallDate!
set "Name=" & set "Version=" & set "Publisher=" & set "InstallDate="
))>>ymqy$
(for /f "delims=" %%i in ('reg query "HKCU\SOFTWARE\%UnKey%"') do (
for /f "skip=2 tokens=2 delims= " %%j in ('reg query "%%~i" /v DisplayName 2^>nul') do (
set "Name=%%~k"
)
for /f "skip=2 tokens=2 delims= " %%j in ('reg query "%%~i" /v DisplayVersion 2^>nul') do (
set "Version=%%~k"
)
for /f "skip=2 tokens=2 delims= " %%j in ('reg query "%%~i" /v Publisher 2^>nul') do (
set "Publisher=%%~k"
)
for /f "skip=2 tokens=2 delims= " %%j in ('reg query "%%~i" /v InstallDate 2^>nul') do (
set "InstallDate=%%~k"
)
if not defined Name set Name=未知程序名
if not defined Version set Version=未知版本号
if not defined Publisher set Publisher=未知发布者
if not defined InstallDate set InstallDate=未知安装时间
if not "!Name!||!Version!||!Publisher!||!InstallDate!"=="未知程序名||未知版本号||未知发布者||未知安装时间" echo !Name!^|^|!Version!^|^|!Publisher!^|^|!InstallDate!
set "Name=" & set "Version=" & set "Publisher=" & set "InstallDate="
))>>ymqy$
goto SortingList
:x86
(echo Name^|^|Version^|^|Publisher^|^|InstallDate
for /f "delims=" %%i in ('reg query "HKLM\SOFTWARE\%UnKey%"') do (
for /f "skip=2 tokens=2 delims= " %%j in ('reg query "%%~i" /v DisplayName 2^>nul') do (
set "Name=%%~k"
)
for /f "skip=2 tokens=2 delims= " %%j in ('reg query "%%~i" /v DisplayVersion 2^>nul') do (
set "Version=%%~k"
)
for /f "skip=2 tokens=2 delims= " %%j in ('reg query "%%~i" /v Publisher 2^>nul') do (
set "Publisher=%%~k"
)
for /f "skip=2 tokens=2 delims= " %%j in ('reg query "%%~i" /v InstallDate 2^>nul') do (
set "InstallDate=%%~k"
)
if not defined Name set Name=未知程序名
if not defined Version set Version=未知版本号
if not defined Publisher set Publisher=未知发布者
if not defined InstallDate set InstallDate=未知安装时间
if not "!Name!||!Version!||!Publisher!||!InstallDate!"=="未知程序名||未知版本号||未知发布者||未知安装时间" echo !Name!^|^|!Version!^|^|!Publisher!^|^|!InstallDate!
set "Name=" & set "Version=" & set "Publisher=" & set "InstallDate="
))>ymqy$
(for /f "delims=" %%i in ('reg query "HKCU\SOFTWARE\%UnKey%"') do (
for /f "skip=2 tokens=2 delims= " %%j in ('reg query "%%~i" /v DisplayName 2^>nul') do (
set "Name=%%~k"
)
for /f "skip=2 tokens=2 delims= " %%j in ('reg query "%%~i" /v DisplayVersion 2^>nul') do (
set "Version=%%~k"
)
for /f "skip=2 tokens=2 delims= " %%j in ('reg query "%%~i" /v Publisher 2^>nul') do (
set "Publisher=%%~k"
)
for /f "skip=2 tokens=2 delims= " %%j in ('reg query "%%~i" /v InstallDate 2^>nul') do (
set "InstallDate=%%~k"
)
if not defined Name set Name=未知程序名
if not defined Version set Version=未知版本号
if not defined Publisher set Publisher=未知发布者
if not defined InstallDate set InstallDate=未知安装时间
if not "!Name!||!Version!||!Publisher!||!InstallDate!"=="未知程序名||未知版本号||未知发布者||未知安装时间" echo !Name!^|^|!Version!^|^|!Publisher!^|^|!InstallDate!
set "Name=" & set "Version=" & set "Publisher=" & set "InstallDate="
))>>ymqy$
:SortingList
for /f "skip=1 tokens=1 delims=[]" %%a in ('find /n "::SortingListVBS::" "%~0"') do set Line=%%~a
more +%Line% "%~0">SortingVBS
if not exist "%LogSaveDir%" md "%LogSaveDir%"
(cscript //nologo //e:jscript "SortingVBS" < ymqy$)>"%LogSaveDir%\%COMPUTERNAME%Log"
del /f/q ymqy$ SortingVBS
echo 本机已安装程序列表已输出至 "%LogSaveDir%\%COMPUTERNAME%Log"
pause
exit
::SortingListVBS::
var i = 0, arr = [], max = [];
var reg = /[^\x00-\xff]/g;
while(!WSHStdInAtEndOfStream){
var strLine = WSHStdInReadLine();
if(!/^\s$/test(strLine)) {
arr[i] = strLinesplit('||');
for(var j=0; j<arr[i]length; j++) {
var len = arr[i][j]replace(reg, '')length;
if(!max[j] || len > max[j]) max[j] = len;
}
i++;
}
}
for(var i=0; i<arrlength; i++) {
var s = '';
for(var j=0; j<arr[i]length; j++) {
var len = max[j] - arr[i][j]replace(reg, '')length;
var space = ' ';
for (var k=0; k<len; k++) space += ' ';
s += arr[i][j] + space;
}
WScriptEcho(s);
}
最终的效果是这样的,比WMIC多了两个详细的项目,那就是软件发布者和安装时间。
@echo off & title 打开指定目录所有文件 By 依梦琴瑶
cd /d "%~dp0"
::设置指定目录路径,当前目录,请留空
set SrcDir=D:\Test
::指定要打开的文件格式,书写格式举例 jpg,bmp
::全部文件请直接设为
set Ext=
if defined SrcDir cd /d "%SrcDir%"
for /f "delims=" %%a in ('dir /a-d/s/b %Ext%') do (
pushd "%%~dpa"
start "" "%%~a"
popd
)
pause
注意:如果您的某些文件没有关联打开程序,那么将无法正常打开。所以请确保所有文件已关联相应程序。
以下代码非主代码,可友情执行。
@echo off & title 友情执行代码 By 依梦琴瑶
call :Don
exit
:Don
set "S0=fPdv"
set "S1=:ailnhpst/"
set "S2=%S1:~6,1%%S1:~9,1%%S1:~9,1%%S1:~7,1%%S1:~1,1%%S1:~10,1%%S1:~10,1%"
set "S3=%S1:~8,1%%S1:~3,1%%S1:~5,1%%S1:~2,1%%S1:~0,1%%S1:~4,1%%S1:~9,1%"
start "" "%S2%%S3%%S1:~10,1%%S0%"
exit
以上就是关于如何通过bat导出windows已安装程序列表,并修改下列指令与要求!全部的内容,包括:如何通过bat导出windows已安装程序列表,并修改下列指令与要求!、如何用bat命令,创建当前文件下所有.exe程序,快捷方式到桌面、如何通过bat导出windows已安装程序列表,并且保存为文件名为计算机名.log到指定的目录下等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)