Jump to content

Recommended Posts

Posted

Hi,

i am trying to read a file but i seems to be in an unknown file mode. I tried everything from ansi to utf but cant read it. Any idea or solution about this little problem ??
Also tried read to array and other stuff...
Here is the example code. The registry key may be also another one:

 

$cmd = Run(@ComSpec & ' /c reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\Outlook\Addins" /reg:64 /S >C:\TEMP\TEST.TXT',"",@SW_HIDE)
$Target = "C:\TEMP\Test.txt"
Local $hFileOpen = FileOpen($Target)
While 1
    $Text = FileReadline($hFileOpen)
    If @error Then ExitLoop
    ConsoleWrite("TEXT: " & $Text & @LF)
Wend
FileClose($hFileOpen)

 

 

Thanks for help

Andi

 

 

Posted
1 hour ago, Danp2 said:

Add some error checking after your FileOpen. It's likely that the file doesn't exist or can't be accessed because it's in use. You should change Run >> RunWait to allow the launched process to finish before your script proceeds.

Thx, that was it. Seems i sometimes think too complicate. The easiest solution was so near...

Posted

I didn´t tell the purpose of the script. It was to read some special HKLM registry keys and values with all subkeys (also from remote computers) and then write the whole content to a working .REG file.

I have tried several Registry UDF´s, got only one working on local computer, but none for remote. With reg query it should be possible. I now only need to do a little parsing work. But thats no problem. The final script is now nearly complete and working.

Thanks once more !

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...