2

I installed neofetch using scoop, and have it in the settings.json for powershell:

"commandline": "%SystemRoot%\\System32\\WindowsPowerShell\\v1.0\\powershell.exe neofetch -nologo",

the neofetch makes it close immediately after printing the last line of the neofetch.

tried using -noexit to no avail, hopefully i can get it to just boot and use neofetch becuase i like the way it looks lol

mklement0
  • 382,024
  • 64
  • 607
  • 775

1 Answers1

2

Mathias has provided the crucial pointer:

  • The PowerShell CLI's own parameters - such as -NoLogo in your case, and often -ExecutionPolicy, -NoProfile and -NoExit - must be placed before any command or script file to invoke and its subsequent pass-through arguments.

  • Anything that follows -File or -Command - or in the absence of either - the first argument that isn't a CLI parameter[1] is considered the script file or command to execute, with all subsequent arguments getting passed through, whatever they are.

Therefore:

  • powershell.exe neofetch -nologo is the same as powershell.exe -Command neofetch -nologo and passes -nologo to neofetch instead of to PowerShell, which presumably causes it to fail and exit right away.

  • You would have to place -nologo before neofetch to work as intended; however, -nologo isn't actually necessary in your case (with -Command and -File, -nologo is implied, except if -File is combined with -NoExit); to demonstrate the correct syntax with -NoExit instead:

# -NoExit (as well as any other PowerShell CLI parameters) must come *first*.
# Same as: 
#   powershell.exe -NoExit -Command neofetch
powershell.exe -NoExit neofetch

In the context of your JSON file:

"commandline": "%SystemRoot%\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -NoExit neofetch",

[1] Note that the CLIs of the two PowerShell editions have different defaults: powershell.exe, the Windows PowerShell CLI,, defaults to -Command, whereas pwsh, the PowerShell (Core) CLI, defaults to -File. See this answer for when to use -File vs. -Command.

mklement0
  • 382,024
  • 64
  • 607
  • 775