Skip to content

CLI args ignored on Cold Start for new files (BroadFileSystemAccess permission issue) #1485

@ChlorisSinica

Description

@ChlorisSinica

Describe the bug
Command line arguments are ignored on Cold Start unless the file has been previously opened (likely added to FutureAccessList). It seems broadFileSystemAccess capability is not functioning correctly during the initial launch activation.

Detailed Findings:

  1. Permission Dependency (The Core Issue):

    • notepads "C:\NewFile.txt" (A file never opened before) -> Fails. Opens an empty "Untitled" window.
    • However, if I drag & drop this file into Notepads once (granting explicit permission), subsequent CLI commands notepads "C:\NewFile.txt" WORK perfectly, even on Cold Start.
  2. Path Dependency:

    • Files in restricted paths (e.g., C:\README.txt) fail consistently on the first try.
    • Some files in user directories might open, suggesting a race condition in permission resolution.

Steps to reproduce

  1. Create a text file in a root or protected location (e.g., C:\Test.txt) that Notepads has never seen.
  2. Terminate Notepads completely (I executed taskkill /F /IM Notepads.exe to ensure no background instances remained).
  3. Run notepads "C:\Test.txt" via Command Prompt.
  4. Result: Empty "Untitled" window opens. (Silent permission failure?)
  5. Verification: Drag and drop C:\Test.txt into the window. Close the app. Run the command again. -> Result: It opens successfully.

Environment

  • App Version: v1.5.6.0
  • OS: Windows 11 Pro 24H2 (OS Build 26100.7623)

Troubleshooting attempted (Detailed)

I have tried all of the following steps, but the "Cold Start" issue persists:

1. Execution Methods:

  • Tested via CMD, PowerShell (Start-Process -ArgumentList), and AutoHotkey.
  • Tested with start "" notepads "path" to handle quoting.
  • Confirmed that notepads.exe path is correct using where command (no path hijacking).
  • Confirmed that explorer.exe "file.txt" works (because Explorer handles the activation).

2. App & System Settings:

  • Privacy Settings: Confirmed "File system" access is toggled ON in Windows Settings.
  • App Maintenance: Performed "Repair" and "Reset" in App Settings.
  • Reinstall: Completely uninstalled, rebooted, and reinstalled the app.
  • Execution Aliases: Toggled "App execution aliases" OFF and ON again.

3. Advanced Activation Tests:

  • Direct PFN Launch: Tried launching via Package Family Name (Start-Process shell:AppsFolder\JackieLiu.Notepads_... -ArgumentList ...). Result: Empty window.
  • Manifest Re-registration: Ran PowerShell command: Get-AppxPackage *Notepads* | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register ...}. Result: Issue persists.

4. Logs & Permissions:

  • Event Viewer: Checked Microsoft-Windows-TWinUI/Operational. NO error events were recorded (The OS considers the activation successful).
  • User Context: Confirmed I am NOT running the terminal as Administrator (ruled out UIPI/Privilege Isolation issues).

5. Isolation Tests (Crucial Findings):

  • Non-existent files: notepads C:\GhostFile.txt -> Opens empty "Untitled" (Argument ignored, no error).
  • Protected Paths: Files in C:\ root fail consistently on cold start.
  • Granting Permission: Once a file is Dragged & Dropped into the window, subsequent CLI commands for that specific file work perfectly (verifying FutureAccessList behavior).

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