Archive for the ‘Windows’ Category

View Hosts

Posted: March 3, 2011 in CLI, Windows

Hello guys,

Today I come with a very fast but convenient shortcut this one to be used to view on the hosts file quickly, as I am usually tweaking with it.

@echo off
type c:\windows\system32\drivers\etc\hosts

This little 2 lines allow you to view the hosts file in console very fast.

just remember to save the .bat file with this 2 lines in the  “c:\windows\system32” so no matter from where you type the command it will be always executed.

I hope this helps anyone that wants to use it.

Cya later!

Ping Connection Test with Sound

Posted: February 8, 2011 in CLI, Linux, Windows

Hello Guys,

I just finished a draft for a Ping Connection Test that emits a sound when its Disconnected, I like this to monitor my internet even if I am not using it, also more actions can be done not just the sound, this is just a start, this is the first draft of the code, I will be posting a step by step details later.

@echo off
set destination=%1
ping %destination% -n 1 |FIND /C “TTL” > c:/temp.log
set /p result=< c:/temp.log
IF %result% EQU 0 (
echo “Connection Inactive”
type beep.txt
ping -w 1000 > NUL
IF %result% EQU 1 (
echo “Connection Active”
ping -w 100000 > NUL

As I said this is just a basic draft later on I will post how to create you own and how to run it.

Hello all,

This miniature batch is just a random number generator that works between 0 and 32767.
What is does.
Takes 2 inputs %1 (Minimum Number) and %2 (Maximum Number)
Then it runs %random%  operation until the returns a number between the range you specified, there are 2 if´s that work as limiter to ensure the batch does not loop.
Please do remember that if you create a batch and want to run it as a command you have to put it in “c:/windows/system32/” and named as command.bat this will allow you to run the command in CMD, this Random Number Generator runs like this.
Note:  Low ranges may take more time as the chance to get a number in that range is lower.



@echo off
set minimum=%1
set maximum=%2
if %maximum% LEQ %minimum% (
echo Maximum is lower than Minimum
goto B
if %maximum% GEQ 32767 (
echo Maximum number is to big please use 32767 or below)
set randnumber=%random%
if %randnumber% GEQ %minimum% (
if %randnumber% LEQ %maximum% (
echo %randnumber%
goto END
goto A

My plan is to make an more interactive version, but not for now, I just needed a quick random command.
Remember that necessity always gives us a chance to create.

Will San