cmd/powershell output to txt

Steven · 2021-02-09 10:59 · 41 views · Windows · old id 25

ping www.baidu.com >C:/log.txt


$Path = "$env:C:\Users\Administrator\Desktop\test4.txt"
$Secret = Hello hello world World!
  
$Secret | Out-File -FilePath $Path

notepad $path


必须有输出到文件的数据

notepad文件才会创建出来

 

outfile

write-output "hello" | out-file -filepath c:\users\administrator\desktop\test1.txt

write-output

$Path = "C:\Users\Administrator\Desktop\test1.txt"

write-output "hello world" >> $Path
write-output "hello again" >> $Path

notepad $Path


← Back to home