8000 Add -Force parameter to Get-Item in Import-Ini to read hidden files · Issue #133 · lipkau/PSIni · GitHub
[go: up one dir, main page]

Skip to content

Add -Force parameter to Get-Item in Import-Ini to read hidden files #133

Open

Description

@koresent

Hi,

I've noticed that Import-Ini cannot read .ini files with the Hidden attribute, such as desktop.ini.

Currently, the code uses:

$source = (Get-Item -LiteralPath $source).FullName

This fails for hidden files:

Import-Ini -Path "$rootPath\desktop.ini"
Get-Item: Could not find item C:\Root\desktop.ini.
Import-Ini: Could not find file '

After adding the -Force parameter to Get-Item:

$source = (Get-Item -LiteralPath $source -Force).FullName

The import works correctly:

Import-Ini -Path "$rootPath\desktop.ini"
Name                           Value
----                           -----
.ShellClassInfo                {[LocalizedResourceName, Тест], [IconResource, %WINDIR%\System32\SHELL32.dll,84]}

Proposed fix:
Update line 120 in Import-Ini.ps1 to include -Force when calling Get-Item.

This should allow the module to read .ini files that are marked as hidden.

Thanks!

Activity

  1. changed the title [-]Add -Force parameter to Get-Item in Import-Ini to read system files[/-] [+]Add -Force parameter to Get-Item in Import-Ini to read hidden files[/+] on Oct 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0