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
lewisaro

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
TanyaC

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
lewisaro

windows 7 pro 64bit
 
 

Brilliant! thankyou so much
My System SpecsSystem Spec
.


03 Apr 2014   #4
lewisaro

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
TanyaC

Linux Mint 17 Cinnamon | Win 7 Ult x64
 
 

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

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
TanyaC

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
lewisaro

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
TanyaC

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
lewisaro

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
Thread Forum
Getting input data after execution of batch file.
My batch file code is like this: @echo off C:\Windows\System32\netsh.exe wlan set hostednetwor mode=allow ssid=User_Name key=password eyUsage=persistent In this code the "User_name" and "password" fields I want the input from the user after running the batch file. How do I make it...
General Discussion
Explorer issues (no description in description column)
Description isn't populated for applications (exe's) in Windows Explorer (like Artist isn't populated for .m4a, where AudioShell is a workaround) http://i.imgur.com/6IRRpuD.png Any workaround?
General Discussion
Batch script that takes drive letter input
Hey guys, since no one replied to my last thread because I don't think it was possible, so I'll make another one on a different perspective. Instead of trying to make the drive letter the same, I would like the script to prompt the user for the drive letter and then input that into the script....
General Discussion
HDMI Input: No Input Signal -- Monitor Going to Sleep
Windows automatically updated last night before shutting down. When I turned on the computer this morning, the HP w2207h monitor was not functioning properly. Each time I rebooted, I received the message "HDMI Input: No Input Signal" before the monitor went to sleep. I do not believe it is a...
Graphic Cards
Does PSU automatically take required input?
I have the same PC config as a Core i5 2400 3.1Ghz,Intel DH67BL,4GB RAM DDR3 1333Mhz(2x2GB Corsair,Kingston),1TB Seagate 7200.14 HDD with no add-on cards.For some days I am not going to "play" graphics intensive games like Call Of Duty series,Crysis,Assassin's Creed series etc.So I took graphics...
Hardware & Devices
Windows 7 64bit Manual Power cut Required for normal startup..(HELP)
Hi guys... new to this forum My comp specs follows: M.board: biostarTh55b HD (t seiries board)** Intel i3 CPu 530@ 2.93 ghz Crosair Memory: 4gb dual channel DDr3 (CMV4GX3M2A1333C9) Raidmax mod # Rx -380 k (power supply) Segatge Barracuda 7200 HD
Hardware & Devices

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 09:09.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App