(view source code of netshare.cmd as plain text)
/* List shared netnames on a server */call RxFuncAdd 'LoadLsRxutFuncs', 'LSRXUT', 'LoadLsRxutFuncs'
call LoadLsRxutFuncsNETSERVER = 160
NETSHARE = 190
SrvType = -1 /* All servers */
parse upper arg SrvName DomainName dummy "/"pause
if SrvName = '' then call Syntax
if left( SrvName, 2 ) <> '\\' then do
DomainName = SrvNameSrvName = ''
endif left( pause, 1 ) = "P" then do
pause = 1
parse value SysTextScreenSize( ) with rows cols
endelse do
pause = 0
endmyRc = NetEnumerate(NETSERVER, 'serverList', SrvName, SrvType, DomainName)
if myRc <> '0' then do
say 'Got error from NetEnumerate() ' myRc
exit 9
endif serverList.0 = 0 then do
say 'Domain controller was not found'
exit 0
endcall SysClssaysay 'Number of servers found: ' serverList.0
k = 0
do i=1 to serverList.0
say say say serverList.imyRc = NetEnumerate(NETSHARE, 'shareInfo', '\\'serverList.i)
if myRc <> '0' then do
say 'Got error from NetEnumerate() ' myRc
exit 9
endif shareInfo.1 = 0 then do
say 'Server does not share a resource'
exit 0
endsay 'Number of shared netnames: ' shareInfo.0
saydo j=1 to shareInfo.0
myRc = NetGetInfo(NETSHARE, 'shareInfoX', '\\'serverList.i, shareInfo.j)
/* myRc = NetGetInfo(NETSHARE, 'shareInfoX', SrvName, shareInfo.j)*/if myRc <> '0' then do
say 'Got error from NetGetInfo() ' myRc
exit 9
end saysay ' Network name : ' shareInfoX.netname
say ' Share type : ' shareInfoX.type
say ' Comment : ' shareInfoX.remark
say ' Local resource path : ' shareInfoX.path
if pause = 1 then call PauseIfNeeded
endendif k > 0 then call PauseIfNeeded 'Exit'
EXIT 0
PauseIfNeeded:param = strip( translate( arg( 1 ) ) )
parse value SysCurPos( ) with x y
k = k + 1
if x > rows - 8 | param = 'EXIT' then do
call SysCurPos rows - 3, 0
say 'Press any key . . .'
call SysCurState 'OFF'
call SysGetKey 'NOECHO'
if param <> "EXIT" then do
call SysCls saysay 'Number of servers found: ' serverList.0
say say say serverList.isay 'Number of shared netnames: ' shareInfo.0
say endk = 0
endreturnSyntax: procedure
saysay 'Usage: NETSHARE [ \\server_name ] [ domain_name ] [ /Pause ]'
sayexit 1
returnpage last modified: 2025-10-11; loaded in 0.0101 seconds