Difference between revisions of "Script Examples for Windows NT/XP"
From Free Knowledge Base- The DUCK Project: information for everyone
m |
m |
||
Line 30: | Line 30: | ||
[[Category:Computer_Technology]] | [[Category:Computer_Technology]] | ||
[[Category:Microsoft]] | [[Category:Microsoft]] | ||
+ | [[Category:Windows]] |
Latest revision as of 14:02, 17 October 2008
Script Example A
BEGIN ::Do a netstat without included name resolution; ::find connection on port 5631 (pcAnywhere). netstat -a -n|findstr "5631" >A.txt 2>nul ::Parse the IP address out of the returned string. for /f "tokens=4 delims=: " %%a in (A.txt) do call :GETNAMES %%a goto :cleanup :GETNAMES ::Do nbtstat to the remote IP address, and parse out the ::<20> name, which is the NetBIOS name of the PCA Client. if %1==0.0.0.0 goto :EOF nbtstat -A %1|findstr "<20>" >>B.txt ::Errorlevel 1 is returned if the above findstr was unsuccessful; ::tell user and quit. IF errorlevel 1 (echo No PCA connection exists) & goto :CLEANUP ::NetBIOS creates <03> entries for username and machinename; ::get them with nbtstat to the remote machine and print out. for /f "tokens=1" %%a in (B.txt) do nbtstat -a %%a|findstr "<03>" :CLEANUP if exist A.txt del A.txt if exist B.txt del B.txt