Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Please help me with Batch, need manual input required see description

02 Apr 2014   #1

windows 7 pro 64bit
 
 
Please help me with Batch, need manual input required see description

Hi there,
I am trying to create a batch file which will use the command nbtstat-a and then request the IP of the user within the same line (e.g. nbtstat-a *please enter the target IP to lookup*) to look up the machine name of a computer on the network, the only problem is that i dont know how to make it so that the first part is automatically filled out (nbtstat -a) then the user has to input the IP address to continue.
Please could anyone help?
Thanks Much Appreciated


My System SpecsSystem Spec
.

02 Apr 2014   #2

Linux Mint 17 Cinnamon | Win 7 Ult x64
 
 

Hi,

Welcome to Seven Forums

To concatenate commands use the & symbol.

For example, Command A & Command B

Try this.

set /p id="Enter IP Address: " & nbtstat -a %id%

Tanya
My System SpecsSystem Spec
03 Apr 2014   #3

windows 7 pro 64bit
 
 

Brilliant! thankyou so much
My System SpecsSystem Spec
.


03 Apr 2014   #4

windows 7 pro 64bit
 
 

I have managed to get the command working when I ping an IP address however when I do nbtstat -a it just loops back to the start and I am unable to do the lookup, I have tried doing timeouts and goto command but it still doesn't seem to work! what am i doing wrong?
My System SpecsSystem Spec
03 Apr 2014   #5

Linux Mint 17 Cinnamon | Win 7 Ult x64
 
 

Can you post your batch file, please
My System SpecsSystem Spec
03 Apr 2014   #6

windows 7 pro 64bit
 
 

this is what I have so far:

@ECHO OFF
set /p "id=Please enter an IP address: "
cls
Ping %ID%
nbtstat -a %id%

it successfully pings however it doesn't do the nbtstat look up it just jumps back "please enter an IP address"
My System SpecsSystem Spec
03 Apr 2014   #7

Linux Mint 17 Cinnamon | Win 7 Ult x64
 
 

Ok, that looks fine to me.
And indeed, it runs perfectly for me.
Here's the output.

Code:
Pinging 192.168.1.2 with 32 bytes of data:
Reply from 192.168.1.2: bytes=32 time=2ms TTL=128
Reply from 192.168.1.2: bytes=32 time=1ms TTL=128
Reply from 192.168.1.2: bytes=32 time=2ms TTL=128
Reply from 192.168.1.2: bytes=32 time=2ms TTL=128

Ping statistics for 192.168.1.2:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 1ms, Maximum = 2ms, Average = 1ms

Local Area Connection:
Node IpAddress: [192.168.1.2] Scope Id: []

           NetBIOS Remote Machine Name Table

       Name               Type         Status
    ---------------------------------------------
    WORKGROUP      <00>  GROUP       Registered
    TANYA-PC       <00>  UNIQUE      Registered
    TANYA-PC       <20>  UNIQUE      Registered
    WORKGROUP      <1E>  GROUP       Registered
    WORKGROUP      <1D>  UNIQUE      Registered
    ..__MSBROWSE__.<01>  GROUP       Registered

    MAC Address = BC-5F-F4-45-5C-B8
I ran it from my desktop, then from my C:\ drive, then as a scheduled task. It worked perfectly every time. I even ran it from within another cmd file, and then "called" it from within another cmd file. Works every time.

So, how are you running it?

Tanya
My System SpecsSystem Spec
04 Apr 2014   #8

windows 7 pro 64bit
 
 

Ive tried it from desktop and c drive and it still loops
http://postimg.org/image/en98ot5jz/ thats whats happening
I have full admin permission so thats not the problem either
My System SpecsSystem Spec
04 Apr 2014   #9

Linux Mint 17 Cinnamon | Win 7 Ult x64
 
 

Hi,

Well, I've spent the last day trying to recreate your problem. Tried it on XP, Windows 7, Windows 8 and 8.1. I tried it on a standard user account, and an administrator account. No matter what I do I can't recreate the problem you're having. This is really bizarre

I'll keep digging and trying different things....

Meanwhile, if any other knowledgeable people are passing by hopefully they will chime in..

btw, should probably add "Set id=" (minus the quotes) as the last line just to clean up after. That will delete the environment variable.



Tanya
My System SpecsSystem Spec
07 Apr 2014   #10

windows 7 pro 64bit
 
 

Hi Tanya, I really appreciate that you have been helping and tried so many ways to get around the issue!
ive had the thought, would the issue be occurring due to the fact that im on a domain?
will add that line now
Thanks again for all the help!
-Lewis
My System SpecsSystem Spec
Reply

 Please help me with Batch, need manual input required see description




Thread Tools



Similar help and support threads for2: Please help me with Batch, need manual input required see description
Thread Forum
Explorer issues (no description in description column) General Discussion
Batch script that takes drive letter input General Discussion
Does PSU automatically take required input? Hardware & Devices
Windows 7 64bit Manual Power cut Required for normal startup..(HELP) Hardware & Devices
Tablet PC Input Service defaults to Manual at restart General Discussion

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 01:53 AM.
Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33