English 中文(简体)
格式权力h G. 档案中的自动密码
原标题:Formatting powershell Get-Content byte code from file
  • 时间:2023-12-13 02:46:06
  •  标签:
  • powershell

我得以通过特制法典,但我试图在这里做的两件事情就是这样。

  1. format the bytecode so that there are 2 digits per byte. The leading zeroes are excluded.
  2. Remove spaces between the bytes themselves because they are taking up a lot of space.
gc -Raw -encoding byte "c:picture.jpg" ^|% {write-host ( {0:x}  -f $_) -noNewline};

尝试了三(三)条,但不能确定这一点是可能的,或者说是什么。

问题回答

http://www.un.org。

[System.BitConverter]::ToString(
  (Get-Content -Raw -Encoding Byte c:picture.jpg)
) -replace  - 

PowerShell (Core) 7+:

[System.Convert]::ToHexString(
  (Get-Content -Raw -AsByteStream c:picture.jpg)
)




相关问题
Mutually exclusive powershell parameters

SCENARIO I m writing a cmdlet for Powershell 2.0 using Visual Studio 2008 and .NET 3.5 the cmdlet requires 3 arguments. my intended grammar of the cmdlet is something like this: cmdletname [foo|...

Run a program from PowerShell with timeout

I ll write a script that runs a program and wait for it finished. But if the program is not finished within a specified time I want that the program is killed.

How to transpose data in powershell

I have a file that looks like this: a,1 b,2 c,3 a,4 b,5 c,6 (...repeat 1,000s of lines) How can I transpose it into this? a,b,c 1,2,3 4,5,6 Thanks

Powershell v2 remoting and delegation

I have installed Powershell V2 on 2 machines and run Enable-PsRemoting on both of them. Both machines are Win 2003 R2 and are joined to the same active directory domain and I can successfully run ...

PowerShell -match operator and multiple groups

I have the following log entry that I am processing in PowerShell I m trying to extract all the activity names and durations using the -match operator but I am only getting one match group back. I m ...

热门标签