I successfully ran 3 commands in my PowerShell script shortcut but after running the last command it prompts the user for "y" or "N" and in my script I want to input "y" and press enter.
After looking at other posts such as this I have tried to ECHO the keystroke but it only works prior to the last command Here you can see the 1st Echo Successfully and the 2nd is stuck because it is paused or something
PowerShell Script
ECHO 'y'
spicetify config current_theme Sleek
spicetify config color_scheme futura
spicetify apply
ECHO 'y'
To feed automated responses to external programs that request interactive input, pipe those responses to them, which they receive via their stdin stream.
Note that, as of PowerShell 7.3.1, a trailing newline (CRLF on Windows, LF on Unix) is automatically and invariably appended to a string you output from PowerShell so that, on Windows, sending
'y'in effect sends"y`r`n", and that newline is usually interpreted as submitting input to an interactive prompt.Therefore, for every one among your
spicetifycalls that may / does prompt for ay/nresponse, do the following, using your last command as the example:Note how string literal
'y'by itself is enough to produce output - no need forecho, which in PowerShell is an alias for the rarely neededWrite-Outputcmdlet - see this answer for more information.