Page 1 of 1

Show /Hide on Network

Posted: 03 Mar 2012 01:51
by MrChuCong
I have the script as follows:
@echo off
goto main
:main
cls
echo 1 Show on Network
echo 2 Hide on Network
echo 3 Exit
:choice
set /P C=[1,2,3]?
if "%C%"=="1" goto showit
if "%C%"=="2" goto hideit
if "%C%"=="3" goto exitit
:showit
net config server /hidden:no
:hideit
net config server /hidden:yes
:exitit
exit

So it can work well? :D

Re: Show /Hide on Network

Posted: 03 Mar 2012 05:08
by foxidrive
I haven't tested this but there are some fixes below.

Code: Select all

@echo off
goto :main
:main
cls
echo 1 Show on Network
echo 2 Hide on Network
echo 3 Exit
:choice
set "C="
set /P C=[1,2,3]?
if not defined c goto :choice
if "%C%"=="1" goto showit
if "%C%"=="2" goto hideit
if "%C%"=="3" goto exitit
goto :main
:showit
net config server /hidden:no
goto :EOF
:hideit
net config server /hidden:yes
goto :EOF
:exitit
exit
goto :EOF