开发者

What am I doing wrong with Out-File? [duplicate]

开发者 https://www.devze.com 2022-12-07 22:24 出处:网络
This question already has answers here: redirecting test-path output to text file (2 answers) 开发者_开发百科Find lines with specific characters recursively
This question already has answers here: redirecting test-path output to text file (2 answers) 开发者_开发百科 Find lines with specific characters recursively (1 answer) Closed 11 hours ago.

I cannot get this command to output to text file. I am trying to use the out-file command.

#Trim up the URL
$data = get-content C:\Dell\Temp\urlhausCopyDL.txt
$data | ForEach-Object {
    $items = $_.split(":")
    write-host  (-join('http:',$items[1])) | Out-File "C:\Dell\Temp\Formulated.txt" -Append
}

It creates the file but it is blank.

It splits the URL and removes whatever is after the second : as we don't need it.

It outputs to Console great, but I just cant get it to write to a file!! :(

A snippet of urlhauscopyDL is here for you:
http://115.55.196.162:57955/bin.sh
http://182.240.54.209:60488/bin.sh
http://176.231.66.63:49310/.i

Thankyou For your help team :)

0

精彩评论

暂无评论...
验证码 换一张
取 消