12-21-2023, 07:46 PM
(This post was last modified: 12-21-2023, 07:59 PM by SpriggsySpriggs.)
For working in PowerShell:
I have formatted them as if you are running it from inside a SHELL call in QB64. The carets (^) are needed to escape the pipe (|) characters. If you are running it already in PowerShell, you would get rid of "PowerShell -NoProfile" and the carets.
If you want the directory listing of all text files sorted (PowerShell):
If you already have a file with content inside of it (PowerShell):
P.S
The "-NoProfile" switch is necessary for PowerShell because there are profile scripts that are loaded when it is started that slow down execution considerably. "-NoProfile" tells it to ignore user settings which speeds up the call.
P.P.S
The redirect to sorted.txt is only necessary if you are not using pipecom. Without pipecom, you won't have access to the direct stdout handle. With it, you would remove that redirect and just grab the raw stdout from the call.
I have formatted them as if you are running it from inside a SHELL call in QB64. The carets (^) are needed to escape the pipe (|) characters. If you are running it already in PowerShell, you would get rid of "PowerShell -NoProfile" and the carets.
If you want the directory listing of all text files sorted (PowerShell):
Quote:PowerShell -NoProfile Get-ChildItem -Filter *.txt ^| Select Name -ExpandProperty Name ^| Sort-Object > sorted.txt
If you already have a file with content inside of it (PowerShell):
Quote:PowerShell -NoProfile Get-Content -Path examplefile.txt ^| Sort-Object > sorted.txt
P.S
The "-NoProfile" switch is necessary for PowerShell because there are profile scripts that are loaded when it is started that slow down execution considerably. "-NoProfile" tells it to ignore user settings which speeds up the call.
P.P.S
The redirect to sorted.txt is only necessary if you are not using pipecom. Without pipecom, you won't have access to the direct stdout handle. With it, you would remove that redirect and just grab the raw stdout from the call.
Tread on those who tread on you