I have a PowerShell script (targeting 5.1) which when run using PowerShell ISE on Windows 10 works fine but in Windows 11 fails. The script pipes string literals to sqlite3.exe, for example
".show" | & .sqlite3.exe db
Successful output on Windows 10:
<code> echo: offeqp: offexplain: autoheaders: offmode: list nullvalue: ""output: stdout colseparator: "|" rowseparator: "n"stats: offwidth:filename: db</code><code> echo: off eqp: off explain: auto headers: off mode: list nullvalue: "" output: stdout colseparator: "|" rowseparator: "n" stats: off width: filename: db </code>echo: off eqp: off explain: auto headers: off mode: list nullvalue: "" output: stdout colseparator: "|" rowseparator: "n" stats: off width: filename: db
Output on Windows 11:
sqlite3.exe : Parse error near line 1: near “.”: syntax error At
line:1 char:11
+ “.show” | & .sqlite3.exe db
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Parse error nea…”: syntax error:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
.show
^— error here
So it appears from the last 2 lines that ISE is adding what I assume is a byte-order mark to the beginning of the script which sqlite3.exe cannot handle.
I realise the obvious option is tell users to just not run it in ISE but I was wondering if there was any way of configuring ISE or rewriting the script to avoid the error?