Sign in to follow this  
Followers 0
bobheart

What do I have wrong here ?

8 posts in this topic

Run(@ComSpec & " /k REGEDIT /E %Temp% \Hotfixes.dat HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix > hotfix.txt")

Won't print out the info ?

Share this post


Link to post
Share on other sites



take out the space between %TEMP% and \hotfixes.dat


"I'm not even supposed to be here today!" -Dante (Hicks)

Share this post


Link to post
Share on other sites

Still no worky ?

Share this post


Link to post
Share on other sites

Is there a better way then how i'm doing ?

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Run(@ComSpec & " /k REGEDIT /E %Temp% \Hotfixes.dat HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix > hotfix.txt")

Won't print out the info ?

I don't know the syntax of that command (REGEDIT /E),

so I can't guarantee this will work.

PS. All in one line.

Run(@ComSpec & ' /c REGEDIT /E %Temp%\Hotfixes.dat "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix" > "' & @ScriptDir & '\hotfix.txt"')
Edited by SlimShady

Share this post


Link to post
Share on other sites

No that didn't work .

I got this from a bat file so all post the file here so you can look at it .

@ECHO OFF
ECHO.

:: Check command line parameter
IF NOT "%1"=="" IF /I NOT "%1"=="/V" GOTO Syntax

:: Check for correct Windows version
IF NOT "%OS%"=="Windows_NT" GOTO Syntax

:: Keep variables local
SETLOCAL

:: /V parameter set verbose display
IF /I "%1"=="/V" SET Verbose=1

:: Gather info from the registry
REGEDIT /E "%Temp%.\Hotfixes.dat" "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix"

:: Display header
ECHO Hotfixes installed on this PC:
ECHO.

:: Summarize all hotfixes gathered from registry
FOR /F "tokens=7 delims=\" %%a IN ('TYPE "%Temp%.\Hotfixes.dat" ^| FIND "[HKEY_"') DO FOR /F "tokens=1 delims=]" %%A IN ('ECHO.%%a ^| FIND "]"') DO CALL :Summarize "%%A"

:: Remove temporary file
IF EXIST "%Temp%.\Hotfixes.dat" DEL "%Temp%.\Hotfixes.dat"

:: Done
ENDLOCAL
GOTO:EOF

:Summarize
SETLOCAL
SET Hotfix=%~1
:: No more details required
IF NOT "%Verbose%"=="1" (
    ECHO.%Hotfix%
    GOTO:EOF
)
:: Gather more details from the registry
REGEDIT /E "%Temp%.\Hotfixes.dat" "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix\%~1"
:: Retrieve the hotfix description from the temporary file we just created
FOR /F "tokens=1* delims==" %%a IN ('TYPE "%Temp%.\Hotfixes.dat" ^| FIND /I "Fix Description"') DO SET Description=%%~b
:: Escape brackets in the description, otherwise the ECHO command will fail
IF DEFINED Description SET Description=%Description:(=^^^(%
IF DEFINED Description SET Description=%Description:)=^^^)%
:: The whitespace in the following line is a tab
ECHO.%Hotfix%   %Description% 
ENDLOCAL 
GOTO:EOF

:Syntax
ECHO Hotfixes.bat,  Version 2.00 for Windows NT 4 / 2000
ECHO Displays a list of hotfixes installed locally
ECHO.
ECHO Usage:  HOTFIXES  [ /V ]
ECHO.
ECHO         /V  list both hotfix numbers and descriptions
ECHO.
GOTO:EOF

Share this post


Link to post
Share on other sites

Is there a better way then how i'm doing ?

I have no idea, I haven't played with exporting or importing the registry via command line. and of course, the registry editor helpfile doesn't mention it's own command line options... a quick google search... found this which shows that /e exports to a file... so the >hotfixes.txt wouldn't get anything passed to it, besides maybe a success or fail message from the app? I figure if I were to do what you're trying I'd do it like this:
Run(@ComSpec & " /c REGEDIT /E %Temp%\Hotfixes.txt HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix")

I changed the /k to a /c because I don't want the CMD window hanging around, and the hotfixes.dat to hotfixes.txt, since I think what you're looking for would be there.

You could also look into using RegEnumKey which is in the unstable build...


"I'm not even supposed to be here today!" -Dante (Hicks)

Share this post


Link to post
Share on other sites

This is from your batch file:

:: Gather info from the registry
REGEDIT /E "%Temp%.\Hotfixes.dat" "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix"

And this is from your AutoIt3 script:

REGEDIT /E %Temp% \Hotfixes.dat HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix > hotfix.txt

I notice 4 differences in these two lines and usually a difference in the command line results in a completely different meaning.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0