powershell_读取文件信息

命令:Get-Content
作用:获取信息
摘要:获取指定位置的项的内容。
语法:
Get-Content [-Path] <System.String[]> [-ReadCount <System.Int64>] [-TotalCount <System.Int64>] [-Tail <System.Int32
>] [-Filter <System.String>] [-Include <System.String[]>] [-Exclude <System.String[]>] [-Force] [-Credential <Syste
m.Management.Automation.PSCredential>] [-Delimiter <System.String>] [-Wait] [-Raw] [-Encoding {ASCII | BigEndianUni
code | BigEndianUTF32 | Byte | Default | OEM | String | Unicode | Unknown | UTF7 | UTF8 | UTF32}] [-Stream <System.
String>] [-UseTransaction] [<CommonParameters>]

Get-Content -LiteralPath <System.String[]> [-ReadCount <System.Int64>] [-TotalCount <System.Int64>] [-Tail <System.
Int32>] [-Filter <System.String>] [-Include <System.String[]>] [-Exclude <System.String[]>] [-Force] [-Credential <
System.Management.Automation.PSCredential>] [-Delimiter <System.String>] [-Wait] [-Raw] [-Encoding {ASCII | BigEndi
anUnicode | BigEndianUTF32 | Byte | Default | OEM | String | Unicode | Unknown | UTF7 | UTF8 | UTF32}] [-Stream <Sy
stem.String>] [-UseTransaction] [<CommonParameters>]
说明:“Get Content”cmdlet在路径指定的位置获取项的内容,例如文件或函数的内容。对于文件,每次读取一行内容并返回ob的集合对象,每个对象代表一行内容。

例子1:
Get-Content -Path D:\测试\移动\tao-333.bin
读取D:\测试\移动\tao-333.bin文件内容

例子2:
Get-Content -Path D:\测试\移动\tao-333.bin | Set-Content D:\测试\移动\123.txt
先读取D:\测试\移动\tao-333.bin内容再写入D:\测试\移动\123.txt文件中

powershell_读取文件信息

上一篇:即将到来的Linux 4.15内核中RISC-V被合并的git log


下一篇:Linux服务器性能评估