|
|
发表于 2023-9-11 16:29:40
|
显示全部楼层
本帖最后由 pda8888 于 2023-9-11 18:22 编辑
今天有一台电脑,用命令:
- nwinfo_x86.exe --cpu --smbios --no-smart --disk --pci=03 --format=json
复制代码
得到的json文本:
- ……
- "Volumes": [
- {
- "Path": "\\Device\\HarddiskVolume7",
- "Volume GUID": "\\\\?\\Volume{62f44054-0000-0000-0000-100000000000}",
- "Starting LBA": 2048,
- "Partition Number": 1,
- "Partition Type": "0x07",
- "Partition ID": "{62F44054-0000-0000-0000-100000000000}",
- "Boot Indicator": "No",
- "Partition Flag": "EXTENDED",
- "Label": "f0e\n e\r7",
- "Filesystem": "NTFS",
- "Free Space": 465978781696,
- "Total Space": 500104687616,
- "Usage": "6.82%",
- "Volume Path Names": [
- {
- "Drive Letter": "D:\\"
- }
- ]
- }
- ]
- ……
复制代码
某盘的卷标有汉字的情况下,JSON文本里面的Label,"f0e\n e\r7",有乱码,在notepad++16进制模式下看,是0x16,会导致jq解析时报错:
- jq: parse error: Invalid string: control characters from U+0000 through U+001F must be escaped at line 99, column 32
- exit status 5
复制代码
|
|