Use Wi-Fi Adhoc Network in Windows 8

imgI guess, by default Windows 8 does not provide a good way to use Ad Hoc network for local file sharing and LAN gameplay between two computers. I big Pocket Tanks fan, so I need to use the LAN gameplay feature. This lead me into discovering a way to use Wi-Fi Adhoc network in Windows 8. The steps involved are pretty simple. Here I am sharing two ways to achieve this in your Windows 8 computer.

The Geeky Way

Paste the following 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 .

REM Run shell as admin (example) – put here code as you like
ECHO.
ECHO ============================
ECHO Setting up Adhoc Network …
ECHO ============================
netsh wlan set hostednetwork mode=allow ssid=LocalAdHoc key=password
netsh wlan start hostednetwork
ECHO Use “netsh wlan stop hostednetwork” command to stop LocalAdHoc Network.
cmd /

Save this file as any name you want with extension “cmd”. Like I saved it as AdHoc.cmd [You can download this file here.]

If you are keen enough to know how this code works, its simple. First few lines of code generates a visual basic script to get administrator privileges in temporary files folder of Windows and then last few lines does the actual work. Notice the SSID in Red colour and Password in Green colour. You can change this as per your requirement.

To use this, just double click the cmd file you created, and now anyone can connect to you using the password as above.

Noob’s Way

If you don’t want look above, straightaway download this file and double click. Network name is “LocalAdHoc” and Password is “password”.

Download

Note: – If you still get any problems while connecting to LAN in Windows 8, check your IP settings are correct and all PCs are in same subnet or not.

1 thought on “Use Wi-Fi Adhoc Network in Windows 8”

Leave a Reply

Your email address will not be published. Required fields are marked *