我有一个字节数组:
$bytes = [System.IO.File]::ReadAllBytes($myFile)
Run Code Online (Sandbox Code Playgroud)
我想对这个数组中的每个字节执行一个XOR运算,就像这样(在python中)
bytes[i] ^= 0x6A // python-style
Run Code Online (Sandbox Code Playgroud)
我试过了
for($i=0; $i -lt $bytes.count ; $i++)
{
$bytes[$i] = $bytes[$i] -xor 0x6A
}
Run Code Online (Sandbox Code Playgroud)
但是不起作用:$ bytes [$ i]的值是0x00.
怎么能在powershell中完成?
谢谢 !
我有一个完整的行文件,我想删除任何与数组中的字符串匹配的行,使用PowerShell:
$stringsiDoNotWant = @("admin", "student")
$content = gc file.txt
Run Code Online (Sandbox Code Playgroud)
但
$content = $content -notcontains $StringsiDoNotWant
Run Code Online (Sandbox Code Playgroud)
不起作用:我在变量中仍然有"admin"和"student" $content.