Comments (3)
Hi, @kyjdp. The output is correct.
Patches
is an array, and in PowerShell when you reference members within an array without specifying the array index, you get all of them.
There are 13 members in the array:
$plist.ACPI.DSDT.Patches.Length
Try this command, to see them all separately using Format-Hex
$plist.ACPI.DSDT.Patches.foreach{ $_.Find | Format-Hex }
or reference each one
$plist.ACPI.DSDT.Patches[0].Find | Format-Hex
$plist.ACPI.DSDT.Patches[1].Find | Format-Hex
# and so on...
from pwshreadxmlplist.
Hi, @kyjdp. The output is correct.
Patches
is an array, and in PowerShell when you reference members within an array without specifying the array index, you get all of them.There are 13 members in the array:
$plist.ACPI.DSDT.Patches.Length
Try this command, to see them all separately using Format-Hex
$plist.ACPI.DSDT.Patches.foreach{ $_.Find | Format-Hex }or reference each one
$plist.ACPI.DSDT.Patches[0].Find | Format-Hex $plist.ACPI.DSDT.Patches[1].Find | Format-Hex # and so on...
@msftrncs
Hello, thank you for your reply
Sometimes I need to look at the actual values of these arrays because I want to modify them
Is there a way to fix this problem? Thank you in advance
PS:
In PowerShell programming language, I spent a lot of time looking for functions to modify plist files. Your function is the only and most powerful,
Thank you for your great work
from pwshreadxmlplist.
Sometimes I need to look at the actual values of these arrays because I want to modify them
Is there a way to fix this problem? Thank you in advance
There is one thing that complicates these arrays. When you query the Find
property without specifying the index to the Patches
array, the result is an array of an array of bytes and PowerShell will just concatenate them together in to a single array of bytes. To modify them, you must process each element of the Patches
array separately, such as using the .foreach
special method, the ForEach-Object
special commandlet, the foreach
statement or lastly creating a for
loop to iterate the array. If you need to modify only a single instance, or just a few, you will need to provide a condition to control the modification.
$plist.ACPI.DSDT.Patches.foreach{
# modify `$_.Find` here
}
# or
$plist.ACPI.DSDT.Patches | ForEach-Object {
# modify `$_.Find` here
}
# or
foreach ($patch in $plist.ACPI.DSDT.Patches) {
# modify `$patch.Find` here
}
# or
for ($i = 0; $i -lt $plist.ACPI.DSDT.Patches.Length; $i ++ ) {
# modify `$plist.ACPI.DSDT.Patches[$i].Find` here
}
from pwshreadxmlplist.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pwshreadxmlplist.