I'm trying to open images in the Windows Photos app using PowerShell. I have a folder with several images like 1.png, 2.png, and 3.png. When I open 2.png directly from File Explorer, I can navigate through the images using the arrow keys. But when I use PowerShell and run the command 'ii .2.png', the arrow keys don't work. Is there a way to open images in PowerShell so that the arrow keys function properly?
2 Answers
Have you tried making sure the image has focus right after you open it? Sometimes you need to click on the image or the window first before arrow key navigation works.
I gave it a shot, and it seems that opening images with Invoke-Item does not allow arrow key navigation as you'd expect. The way PowerShell launches the Photos app may not include the working directory, which File Explorer does, and that could be the key difference. You might want to try using a different photo application if you keep running into issues. I used IrfanView back in the day; it's quick and might behave better with keyboard navigation.
Just a heads up, you might want to try opening the image directly by using the command .2.png or even & "./2.png". I think Invoke-Item might be causing the navigation issue.

I just found out that you can actually open the old Windows Photo Viewer instead. This way, the arrow keys work right out of the box! You can do it by running the following command: Start-Process -FilePath 'rundll32.exe' -ArgumentList "`"$( Join-Path -Path $env:ProgramFiles -ChildPath 'Windows Photo ViewerPhotoViewer.dll' )`", ImageView_Fullscreen C:PathToYourImage.png. Check out more about this on TenForums for a guide!