Wednesday, 8 January 2014

Easiest Way to Create Ad hoc Network (without any Software)

In daily life we need to create Ad-hoc network specially for students because most of colleges & universities Provide internet via LAN . So to access internet on your tab or smartphone or another device most of us uses create ad-hoc network on your laptop or other devices.


Many of us uses some paid software like connectify-me or others. Some of us write command in CMD .
But typing command  each time to start & stop ad-hoc network may irritates many persons .

So specially for those I guys . I suggest you to create batch Program for start & stop Ad-hac network by just one click.

Related Post : How to host your website for FREE (google drive )

I think you all are familiar with Batch programming . If Not  Don't worry shortly we are going to  post introduction & basics of batch programming. for now just follow Procedure ..

Related Post :PHP crash course -1

Procedure  : 

>>> Copy below code & past it in notepad.


@echo off
    CLS

    :checkPrivileges
    NET FILE 1>NUL 2>NUL
    if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges )

    :getPrivileges
    if '%1'=='ELEV' (shift & goto gotPrivileges) 

    setlocal DisableDelayedExpansion
    set "batchPath=%~0"
    setlocal EnableDelayedExpansion
    ECHO Set UAC = CreateObject^("Shell.Application"^) > "%temp%\OEgetPrivileges.vbs"
    ECHO UAC.ShellExecute "!batchPath!", "ELEV", "", "runas", 1 >> "%temp%\OEgetPrivileges.vbs"
    "%temp%\OEgetPrivileges.vbs"
    exit /B

    :gotPrivileges
    setlocal & pushd .
netsh wlan set hostednetwork mode=allow ssid=Beginer2cs_adhoc  key=Mypass
netsh wlan start hosted network


>>> Beginer2cs_adhoc  this is your Ad-hoc netork name && Mypass is your default password          you can change these information any time you required.
>>> Now save this with any name but extension must be .bat 
          Ex start.bat
         
how to save batch program

>>> Now whenever you wan't to start ad-hoc just double click on this batch file . If your laptop have         hardware  support support for ad-hoc network your ad-hoc network created .

>>> Now to share your internet Goto :  Control Panel\Network and Internet\Network Connections
       
easy way to create ad hoc network withot any soft

>>> Open properties of network through which your computer connected.


>>> share your internet over ad-hoc network as shown in above fig.

Related Post : Easiest Way to Create Ad hoc Network (without any Software)

>>> NOW to stop this ad-hoc network . copy And past below code into notepad.


@echo off
    CLS

    :checkPrivileges
    NET FILE 1>NUL 2>NUL
    if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges )

    :getPrivileges
    if '%1'=='ELEV' (shift & goto gotPrivileges) 

    setlocal DisableDelayedExpansion
    set "batchPath=%~0"
    setlocal EnableDelayedExpansion
    ECHO Set UAC = CreateObject^("Shell.Application"^) > "%temp%\OEgetPrivileges.vbs"
    ECHO UAC.ShellExecute "!batchPath!", "ELEV", "", "runas", 1 >> "%temp%\OEgetPrivileges.vbs"
    "%temp%\OEgetPrivileges.vbs"
    exit /B

    :gotPrivileges
    setlocal & pushd .
 netsh wlan stop hostednetwork


>>> Save this Batch program with extension .bat  as previous case
        Ex. stop.bat
>>> JUsT double click on it whenever you wan't to stop this Network.
Related Post : Selection Sort (concept & algorithm)
NOW you have to Batch program start.bat & stop.bat . whenever you want to start your hotspot or Ad-hoc network just click on start.bat && whenever you want to stop this network click on stop. bat

Video DeMO



If YOU LIKE THIS MUST COMMENT && SHARE  

3 comments:

THANKS FOR UR GREAT COMMENT

Blogger Widgets