I've installed today, the Screenfetcher module for Windows - as follows:
PS D:\INSTALKI\ScreenFetch> Find-Module -Repository Local
Version Name Repository Description
1.0.2 windows-screenfetch Local Powershell port of the Bash Screenshot Information Tool
PS C:\> Get-Command -Module windows-screenfetch
CommandType Name Version Source
----------- ---- ------- ------
Function Screenfetch 0.0 windows-screenfetch
Then I have created script: screenfetch.bat with such entry:
C:\>type "C:\Program Files\ScreenFetch\screenfetch.bat"
@echo off
echo.
PowerShell.exe -command screenfetch
Then I've added path: C:\Program Files\ScreenFetch to the windows variable PATH to run this script directly from a command line with command:
screenfetch
But every time when I'm running command: screenfetch - then loop is starting and command is not executed.
But if I rename the script C:\Program Files\ScreenFetch\screenfetch.bat to any other name - example: C:\Program Files\ScreenFetch\dupa.bat - then script is executing properly:
C:\>"Program Files\ScreenFetch\dupa.bat"
....:::: Marcin@Laptop
....:::::::::::: OS: Microsoft Windows 10 Pro 64-bit
....:::: :::::::::::::::: Kernel: 10.0.19044
....:::::::::::: :::::::::::::::: Uptime: 0d 5h 50m 44s
:::::::::::::::: :::::::::::::::: Motherboard: LENOVO 20FMS05K2D
:::::::::::::::: :::::::::::::::: Shell: PowerShell 5.1.19041.1682
:::::::::::::::: :::::::::::::::: Resolution: 1920 x 1080
:::::::::::::::: :::::::::::::::: Window Manager: DWM
................ ................ Font: Segoe UI
:::::::::::::::: :::::::::::::::: CPU: Intel(R) Core(TM) i5-6300U CPU @ 2.40GHz
:::::::::::::::: :::::::::::::::: GPU Intel(R) HD Graphics 520
:::::::::::::::: :::::::::::::::: RAM: 9278MB / 16205 MB (57%)
'''':::::::::::: :::::::::::::::: Disk C: 130GB / 194GB (67%)
'''':::: :::::::::::::::: Disk D: 717GB / 753GB (95%)
''''::::::::::::
''''::::
Does anybody know why the loop is generating? What is wrong with the same PowerShell and CMD script name?
I would be grateful for any advice.
where screenfetchshow when yourscreenfetch.batexists and when you have renamed it todupa.bat? I'm not sure about PowerShell, but AFAIK Windows searches command extensions in the order of variablePATHEXT, so it might find your scriptscreenfetch.batbefore the realscreenfetchcommand. – Bodo Dec 07 '22 at 15:55%PATH%to find it.. When specify a command without extension, Windows tries few possibilities (traditionally.exe,.bat,.com). I guess the first working guess forscreenfetchin your script isscreenfetch.batin the current directory, so the script, hence the loop. Linux is different. :) – Kamil Maciorowski Dec 07 '22 at 17:50