Enable/Disable IPv4 on Windows

CK1820 
Created at Feb 24, 2024 14:02:15
Updated at Feb 24, 2024 14:04:46 
116   0   0   0  

Disabling IPv4 on Windows through a batch script can be a bit more involved compared to disabling IPv6, but it's still achievable using netsh. Here's a script that disables IPv4 on all network interfaces:

@echo off
echo Disabling IPv4...
for /f "tokens=2 delims=:" %%a in ('netsh interface ipv4 show interfaces ^| find "Interface"') do (
    netsh interface ipv4 set interface "%%a" disabled
)
echo IPv4 disabled successfully.
pause

Save this script with a .bat extension (e.g., disable_ipv4.bat). When you run this script with administrative privileges, it will disable IPv4 on all network interfaces. You can use below if you want

disable_ipv4.bat

Again, use caution when running scripts that require administrative privileges, as they can have significant impacts on your system's network connectivity. Always review scripts thoroughly before execution.

 

Below is code for enabling IPv4

@echo off
echo Enabling IPv4...
for /f "tokens=2 delims=:" %%a in ('netsh interface ipv4 show interfaces ^| find "Interface"') do (
    netsh interface ipv4 set interface "%%a" enabled
)
echo IPv4 enabled successfully.
pause

You can use below if you want

enable_ipv4.bat

 



Tags: Disable IPv4 Enable IPv4 IPv4 disable_ipv4.bat enable_ipv4.bat netsh Share on Facebook Share on X

◀ PREVIOUS
Enable/Disable IPv6 on Windows
  Comments 0
Login for comment
SIMILAR POSTS

Enable/Disable IPv6 on Windows (updated at Feb 24, 2024)

Public DNS (Domain Name Service) based on IPv4, IPv6 widely used (updated at Feb 23, 2024)

How do I determine the client IP type in Python - IPv4 or IPv6 (updated at Apr 13, 2024)

How do I determine the client IP type (IPv4/IPv6) in PHP (updated at Apr 16, 2024)

OTHER POSTS IN THE SAME CATEGORY

Enable/Disable IPv6 on Windows (updated at Feb 24, 2024)

Check if a file exists from inside a batch file (updated at Dec 21, 2023)

File synchronization method using WinSCP script – downloading modified files from remote server, useful way to backup files through SSH (created at Jul 29, 2013)

Remote Desktop not work after SP3 installation ? (created at Dec 15, 2008)

How to make application speed faster (updated at Jan 02, 2024)

Changing ANY user password without having to know the existing password (created at Dec 06, 2007)

Windows XP Internet Connection Sharing: Port Forwarding Difficulties (updated at Jan 15, 2024)

Editing your Web browser's settings for faster loading of pages (updated at Jan 02, 2024)

Increase bandwidth by tweaking QoS in Windows XP Pro (created at Sep 03, 2007)

Tweak DNS Errors Caching in Windows 2000 / XP (created at Sep 03, 2007)

Stop the system automatically rebooting after Windows Updates (created at Sep 03, 2007)

How to change the listening port for Remote Desktop? (created at Aug 31, 2007)

UPDATES

Creating a Pinterest-Style Card Layout with Bootstrap and Masonry (created at Apr 24, 2024)

Mastering Excel Data Importation in PHP (updated at Apr 24, 2024)

JSON format control in PHP (updated at Apr 24, 2024)

Equal Height Blocks in Bootstrap with JavaScript (created at Apr 22, 2024)

How to convert integer to text string ? (updated at Apr 22, 2024)

Checking similarity between two strings in PHP (updated at Apr 21, 2024)

Create Blob Image in HTML based on the given Text, Width and Height in the Center of the Image without saving file (updated at Apr 21, 2024)

How do I determine the client IP type (IPv4/IPv6) in PHP (updated at Apr 16, 2024)

How do I determine the client IP type in Python - IPv4 or IPv6 (updated at Apr 13, 2024)

Getting Started with PyTorch: A Beginner's Guide to Building Your First Neural Network (updated at Apr 09, 2024)

Predicting Buyer Preferences with PyTorch: A Deep Learning Approach (updated at Apr 09, 2024)

Forecasting the Weather with PyTorch: A Beginner's Guide to Temperature Prediction (created at Apr 09, 2024)

PyTorch example to Forcast Stock Price based on 10 days Dataset (created at Apr 09, 2024)

Mastering Model Persistence: Saving and Loading Trained Machine Learning Models in Python (created at Apr 08, 2024)

Harnessing the Power of Random Forest Algorithm in Python (created at Apr 08, 2024)

Understanding and Implementing K-Nearest Neighbors (KNN) Algorithm in Python (created at Apr 08, 2024)

Forecasting with Linear Regression and KNN Regression in Python (updated at Apr 07, 2024)

What is 302 Found Redirection in HTTP 1.1? (created at Apr 04, 2024)

Mastering Random Forest Regression: A Comprehensive Guide with Python Examples (updated at Apr 01, 2024)

Python Implementation of Linear Regression (updated at Apr 01, 2024)

Mastering Supervised Machine Learning with Python: A Comprehensive Guide (created at Apr 01, 2024)

Mastering AI: A Beginner's Guide to Python Programming and Beyond (created at Apr 01, 2024)

How do I create animated background for Google Meet? (updated at Mar 28, 2024)

Building a Simple DNS Server in Delphi with TTL Support (created at Mar 16, 2024)

How to force cookies, disable php sessid in URL ? (updated at Mar 16, 2024)

Implementing a Versatile DNS Server in PHP: Handling A, AAAA, CNAME, and TXT Records (updated at Mar 16, 2024)

Implementing a Versatile DNS Server in Python: Handling A, AAAA, CNAME, and TXT Records (created at Mar 16, 2024)

Building a Basic DNS Server in PHP/Python: A Beginner's Guide (updated at Mar 15, 2024)

Dynamic DNS Made Easy: Building a Python-Based Solution (created at Mar 15, 2024)

Exploring the Depths of Data Transfer: sendfile vs. kTLS (created at Mar 15, 2024)