2

I am trying to use xxd command to convert string to hex. I have typed this command in cmd in windows xxd -p <<< "Hello world". But I have got this in my cmd 'xxd' is not recognized as an internal or external command, operable program or batch file.

How can I use xxd in cmd in windows?

Thanks.

4

7 Answers 7

10

You could use git-bash to do that if you have installed it.

example

9

Use VIM for this

https://ftp.nluug.nl/pub/vim/pc/gvim73_46_s.zip

C:\Program Files (x86)\Vim\vim74>.\xxd -v

Source: https://superuser.com/a/638850

2

If you have PowerShell version 5.0 or later, you can use the PowerShell built-in function Format-Hex

$ Format-Hex '.\your-file-name'

It is not as powerful as xxd but you can run it natively in Windows

2
  • 1
    Interestingly, while Microsoft's documentation appears to indicate that we need -Path to specify the filename, I've experimented and Format-Hex '.\your-file-name' works just as described in this answer.
    – AJM
    Commented Jun 3 at 9:10
  • Or at least, it does on Powershell 5.1. I haven't tested with a 6.x or later Powershell.
    – AJM
    Commented Jun 3 at 9:18
1

These days the full linux kernel is made available and officially supported by windows via WSL. Once installed, a program like Windows Terminal can be used to execute linux commands.

0

Short answer is you probably can't because it's a UNIX command...

What you can do is use GnuWin32/MinGW/CygWin, which are ports of Linux GNU utilities fro Windows.

Read more about them here: Difference between GNUWin32 and cygwin

0

See this utility clone.

https://sourceforge.net/projects/xxd-for-windows/

The operation is similar. To see in hexadecimnal use "xxd file.txt", to see in binary use "xxd -b file.txt".

0

I use xxd in the Windows subsystem for linux. If you can, install Ubuntu or Kali Linux in windows by enabling wsl and then installing it via the Microsoft store. you can run xxd and even use it nin combination with vi to hex edit files

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.