Computing.Net > Forums > Windows XP > How to write nbtstat -a batch file?

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

How to write nbtstat -a batch file?

Reply to Message Icon

Name: sanipon
Date: April 19, 2006 at 00:50:05 Pacific
OS: WinXP
CPU/Ram: Centrino 1.7 / 512 mb
Product: -
Comment:

Hi, i am a novice for writing batch files, i would like to know how to write .bat file so that it can run the command "nbtstat -a 192.168.0.1" (for example)and store it in to some result text file.
I got the following .bat file from my friend which is used for pining many ip's from the text file and store the result in another text file. Not sure if i can apply to for nbtstat command:


@echo on
for /f "tokens=*" %%I in (C:\ping\works.txt) do call :pinger %%I
goto :eof
:pinger
---------- >> result.txt
echo %time% >> result.txt
ping -n 1 %1 >> result.txt

Thanks a lot !



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: April 19, 2006 at 01:56:42 Pacific
Reply:

Hi,

Not sure about nbtstat because I don't have a network.

But the bat syntax looks OK. EXCEPT that I would add

goto :eof

after the ping line to "end the subroutine".

AND your first line needs to be:

@echo OFF

Probably neither will effect the usefulness of this bat, but may seriously impact others.


HTH


=====================================
If at first you don't succeed, you're about average.

M2Go



0

Response Number 2
Name: sanipon
Date: April 19, 2006 at 03:28:45 Pacific
Reply:

Yep i tried it but it still running erros in the terminal... im not even sure if ntbstat -a can even be applied with this code


0

Response Number 3
Name: Mechanix2Go
Date: April 19, 2006 at 03:57:41 Pacific
Reply:

Try running individual nbtstat command at the prompt to get the command right. Then try to natch it.

What is in your:

C:\ping\works.txt

?


=====================================
If at first you don't succeed, you're about average.

M2Go



0

Response Number 4
Name: sanipon
Date: April 19, 2006 at 04:04:02 Pacific
Reply:

Okay it works fine for me now, just renamed nbtstat.bat file to test.bat and then apply the following command .....now it works.

@echo on
for /f "tokens=*" %%I in (C:\ping\nbtstat\works.txt) do call :pinger %%I
goto :eof
:pinger
---------- >> result.txt
echo %time% >> result.txt
nbtstat -a %1 >> result.txt


Thanks a lot !


0

Response Number 5
Name: Mechanix2Go
Date: April 19, 2006 at 04:08:49 Pacific
Reply:

Yeah, If you name a BAT to the same name as an EXE COM or internal command, things can get very weird.


=====================================
If at first you don't succeed, you're about average.

M2Go



0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Windows XP Forum Home


Sponsored links

Ads by Google


Results for: How to write nbtstat -a batch file?

Make a batch file to copy data www.computing.net/answers/windows-xp/make-a-batch-file-to-copy-data-/103565.html

How to write XP-Batch files www.computing.net/answers/windows-xp/how-to-write-xpbatch-files/32988.html

Freezing- How to avoid! www.computing.net/answers/windows-xp/freezing-how-to-avoid/21712.html