Windows OS

How to Run xxd Command in Windows

xxd” is a UNIX and Linux-based command utility that can be utilized to create a hexa dump for a provided file. A hexa dump is a tool that will be used to view binary files in hexadecimal, octal, or ASCII format. The xxd command will convert the binary files into different formats such as octal, hexadecimal, ASCII code, and so on.

In this tutorial, we will elaborate on the method of how to install and run the xxd command on Windows.

How to Install xxd on Windows?

To use xxd on Windows, we need to install Vim that supports the xxd command on Windows. Let’s check out the steps required to install Vim on Windows.

Step 1: Install Vim Setup File

To install Vim on Windows, navigate to the below-provided link and download the “gvim90.zip” setup file:

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

Step 2: Extract Compressed File

Go to the “Downloads” folders, right click on the compressed file and select “Extract Here” option:

We have successfully downloaded and extracted the setup folder of Vim that supports the xxd command.

How to Set Up xxd on Windows?

To set up xxd on Windows, follow the below-provided steps.

Step 1: Copy xxd Directory Path

Go to the “bin” folder of the xxd directory to find the “xxd.exe” file and copy the directory path from the “Address bar”:

Step 2: Set Path Environment Variable

Open up the “Startup” menu, type “Environment Variables,” and open the highlighted Control Panel settings:

Go to the “Advanced” tab from the “System Properties” window. Then, click on the “Environment Variables” button to open the related settings:

Go to the “Path” option of the “System Variables” panel and hit the “Edit” button:

Press the “New” button to add the Vim directory path, and press the “OK” button:

We have set the xxd command on Windows. Let’s check out the method to use the xxd command.

How to Run xxd on Windows?

To run the xxd command on Windows, follow the below-provided instructions.

Step 1: Open Command Prompt

In the “Startup” menu, search for “cmd” to open the Command Prompt:

Step 2 Check xxd Version

To verify that the xxd command is working properly on Windows, check out its version:

>xxd --version

As you can see, we have installed “2202-01-14” latest version of the xxd command on our system:

Step 3: Convert File Content into HexaDecimal Format

The xxd command is mainly used to convert binaries files into a different format. Have a look at the given examples to use the xxd command on Windows.

Example 1: Convert Text File into HexaDecimal

This example will convert the “File.txt” into the hexadecimal format:

>xxd File.txt

The below-given output indicates that we have successfully converted the text file into hexadecimal format:

Example 2: Convert Binary File into HexaDecimal

Let’s use the“xxd” command to run the binary file with extension “.bin” and convert it in hexadecimal format:

>xxd File.bin

Example 3: Copy File and Prepend 50 bytes of 0x00 Value

Use the given command to copy the content of “File.txt” into “Result.txt” and add additional 50 bytes before adding the first word of the given file:

>xxd File.txt | xxd -r -s 50 > Result.txt

The printed “Zeroes” indicate that the file is prepended 50 bytes in hexadecimal format:

We have effectively elaborated the method to install and run the xxd command on Windows.

Conclusion

To run the xxd command on Windows, it is required to download Vim, which supports this command. Then, set the Path environment variable to access the xxd command on Windows Command prompt. In order to use xxd command to convert files into the hexadecimal format, utilize the “xxd File.bin” command. In this article, we have compiled the method to install and run xxd on Windows.

 

About the author

Rafia Zafar

I am graduated in computer science. I am a junior technical author here and passionate about Programming and learning new technologies. I have worked in JAVA, HTML 5, CSS3, Bootstrap, and PHP.