私はバッチを少しだけ学んだばかりです。私は恥知らずにこのコードをウェブサイトから持ち上げたことに同意します。これは、インストールされているソフトウェアのリストを表示するためのコードですが、バージョンとソフトウェアは異なる行に表示されていますが、問題は1つだけです。どのように私は同じ行に両方を持つことができますか?インストールされているソフトウェアのバッチファイル
例:バッチを実行すると、バージョンが最初に表示され、次にソフトウェアが表示されます。
ご協力いただければ幸いです。前もって感謝します。
@echo off
If Exist C:\Final.txt Del C:\Final.txt
regedit /e C:\regexport.txt "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall"
regedit /e C:\regexport2.txt "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall"
regedit /e C:\regexport3.txt "HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall"
find "DisplayName" C:\regexport.txt > C:\regprogs.txt
find "DisplayName" C:\regexport2.txt >> C:\regprogs.txt
find "DisplayName" C:\regexport3.txt >> C:\regprogs.txt
for /f "tokens=2 delims==" %%a in (C:\regprogs.txt) do echo %%~a >> C:\installedprogs.txt
find "DisplayVersion" C:\regexport.txt > C:\regprogs.txt
find "DisplayVersion" C:\regexport2.txt >> C:\regprogs.txt
find "DisplayVersion" C:\regexport3.txt >> C:\regprogs.txt
for /f "tokens=2 delims==" %%a in (C:\regprogs.txt) do echo %%~a >> C:\installedprogs.txt
del C:\regexport.txt
del C:\regexport2.txt
del C:\regexport3.txt
del C:\regprogs.txt
sort C:\installedprogs.txt > C:\alles.txt
del C:\installedprogs.txt
:: script om alle dubbele lijnen eruit te gooien
REM -- Prepare the Command Processor --
SETLOCAL ENABLEEXTENSIONS
SETLOCAL EnABLEDELAYEDEXPANSION
REM -- Prepare the Prompt for easy debugging -- restore with prompt=$p$g
prompt=$g
rem The finished program will remove duplicates lines
:START
set "_duplicates=TRUE"
set "_infile=C:\alles.txt"
set "_oldstr=the"
set "_newstr=and"
call :BATCHSUBSTITUTE %_infile% %_oldstr% %_newstr%
pause
goto :SHOWINTELL
goto :eof
:BATCHSUBSTITUTE
type nul> %TEMP%.\TEMP.DAT
if "%~2"=="" findstr "^::" "%~f0"&GOTO:EOF
for /f "tokens=1,* delims=]" %%A in ('"type %1|find /n /v """') do (
set "_line=%%B"
if defined _line (
if "%_duplicates%"=="TRUE" (
set "_unconverted=!_line!"
set "_converted=!_line:"=""!"
FIND "!_converted!" %TEMP%.\TEMP.DAT > nul
if errorlevel==1 (
>> %TEMP%.\TEMP.DAT echo !_unconverted!
)
)
) ELSE (
echo(>> %TEMP%.\TEMP.DAT
)
)
goto :eof
:SHOWINTELL
@echo A|move %TEMP%.\TEMP.DAT C:\allesnietdubbel.txt
del C:\alles.txt
::Alle lijnen weggooien waar 'KB' in voor komt
type C:\allesnietdubbel.txt | findstr /V KB > C:\drivers\Final.txt
goto :eof
exit
「新規」 Microsoftはこの30年以上前の言語から移行し、Windowsでのスクリプト作成の推奨環境はPowerShellになりました。インストールされたソフトウェアを見つけるには、['Win32_Product' WMIクラスを見てください](https://blogs.technet.microsoft.com/heyscriptingguy/2011/11/13/use-powershell-to-quickly-findインストールされたソフトウェア/)、少なくとも開始する。 – alroc
ありがとうalroc、私はPSが良いことを知っていますが、私はそれが私がそれを求めている理由を見つけることに近いです。 - WMIクラスがインストールされているすべてのソフトウェアを表示していないことも読んでいます。レジストリエントリだけがそれを行います。 – SS97