Posts

Showing posts with the label batch script

Change IP address using a batch script in Windows 10

Here's how to quickly change your IP address with a batch script in Windows. First, check the output of the "ipconfig" command. The command will print names of your network interfaces and their settings. Then, if your ethernet adapter is called "Ethernet", you can set it to DHCP with the following batch script: netsh interface ipv4 set address name="Ethernet" dhcp netsh interface ipv4 set dns name="Ethernet" dhcp pause If you create a .bat file from that and run it as administrator , your network settings will change to automatic (DHCP). Other useful netsh examples: Set your IP to 192.168.1.120 and subnet mask to 255.255.255.0 netsh interface ipv4 set address name="Ethernet" static 192.168.1.120 255.255.255.0 Set gateway address to be 192.168.1.1 netsh interface ipv4 set address name="Ethernet" gateway=192.168.1.1 Remove DNS server settings netsh interface ipv4 delete dnsserver name="Ethernet" all

How to use the new Windows Terminal

The new Windows Terminal is awesome! If you are a frequent command line user I highly recommend you to try it. However, the user documentation could be better. Here's a few tips for beginners: How to start Windows Terminal from command line? Simply type wt to open Windows Terminal. If you want to open it in the current folder, try this: wt -d . How to start a batch script file in Windows terminal? start wt -d . cmd.exe /C my_batch_file.bat or, you could create a shortcut, edit it's properties and set the target to be: wt -d . cmd.exe /C my_batch_file.bat How to search for text in the Windows Terminal window? Press ctrl+shift+f to search. How to copy text from the Windows Terminal to clipboard? Left-click and drag to select some text. Then right-click the terminal window. How to paste text from clipboard to the Windows Terminal? Right-click the terminal window. More reading Here is the full list of default keybindings for Windows Terminal . Some more keyboard shortcuts are ex...

Create a sleep timer for Youtube, Twitch, Netflix etc. on Windows 10

Here are instructions on how to create a Windows 10 sleep timer that will close your browser after a specified time. It's great for those who like to watch Youtube at night. Just copy and paste this into notepad, then save the file with a .bat file extension, for example sleepbrowser.bat. The below script will close Firefox after 60 minutes. You can easily edit the delay in minutes. Just edit the row "SET SLEEPDELAYMIN=60". If you use Chrome, Opera, Internet explorer or Edge, just replace the part 'firefox.exe' with your browser's executable name. This works also as a sleep timer for any other type of program than just browsers. You could make it close Spotify or Winamp as well. Here is the batch script. echo off SET SLEEPDELAYMIN=60 SET /A SLEEPDELAY=60*SLEEPDELAYMIN echo Will close Firefox after %SLEEPDELAYMIN% minutes timeout /t %SLEEPDELAY% /nobreak echo Killing Firefox... taskkill /F /T /IM firefox.exe I use the script also to start t...