in reply to Re: Perl & Window's system stuff: Can they get along?
in thread Perl & Window's system stuff: Can they get along?

On an NT-based system, there's no need to do a system call to the shell to determine the Windows directory. $ENV{windir} (or $ENV{SystemRoot}) has it.

Update: As pointed out below, $ENV{windir} works on 9x systems as well.

Replies are listed 'Best First'.
Re: Re: Re: Perl & Window's system stuff: Can they get along?
by Braindead_One (Monk) on Mar 19, 2001 at 12:09 UTC
    $ENV{'windir'} also works fine on 9x.
    In 9x the start menu can be found in the registry :
    'HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Start Menu'
    I dont know about NT/2k, but it should be the same. hope this helps you
    Braindead One
      Just wondering:

      Is the only way to read the windows registry with the Win32::TieRegistry module oribital mentions, or is there an even more straigtforward way?

        The files the registry is stored in are kept open by Windows while it is running for obvious reasons, so the only way to change anything in the registry is via the Win32 API; also, the registry is threadsafe, which would make things as file access much harder.

        There is some documentation on the Windows 9x file format and the NT4 file format of user.dat, one part of the registry, out there, and I even wrote some partly Perl scripts to modify offline registry files, but I never got far, as I wanted to use it for changing the IP address of my notebook at bootup, but then changed to use DHCP anyway...

        I'm interested in what you find not straightforward about using Win32::TieRegistry. You can use Win32API::Registry but I find that less straightforward (unless you are already used to accessing the registry via the C API).

        But I'm honestly interested in what you looked at or tried and how you think things could be improved.

                - tye (but my friends call me "Tye")