Windows 8 and 8.1 Forums

Batch File Question

  1. #1


    Posts : 70
    windows 8.1

    Batch File Question


    I'm in the process of automating configuration for Windows at installation, like disabling services that are exploitable or that I just don't use. I wrote a batch file script for disabling the services, but now I would like to disable NetBIOS over TCP/IP using a batch file command. This is how to do it by hand:

    wmic nicconfig get caption,index,TcpipNetbiosOptions
    then, using the retrieved index number:
    wmic nicconfig where index=1 call SetTcpipNetbios 2

    how do I assign a variable to the resulting index number in step 1, then use that variable in the next command?
    Thanks!

      My System SpecsSystem Spec

  2. #2


    Posts : 2,690
    Windows 3.1 > Windows 10


    wmic nicconfig get caption,index,TcpipNetbiosOptions
    set index=%1%
    wmic nicconfig %1% call SetTcpipNetbios 2
      My System SpecsSystem Spec

  3. #3


    Posts : 70
    windows 8.1


    Quote Originally Posted by KYHI View Post
    wmic nicconfig get caption,index,TcpipNetbiosOptions
    set index=%1%
    wmic nicconfig %1% call SetTcpipNetbios 2
    Thank You Thank You!
      My System SpecsSystem Spec

  4. #4


    Posts : 2,690
    Windows 3.1 > Windows 10


    Did it work??
      My System SpecsSystem Spec

  5. #5


    Posts : 70
    windows 8.1


    Quote Originally Posted by KYHI View Post
    Did it work??
    Not working, but I'll fiddle with it for awhile, see if I can get it to work...
      My System SpecsSystem Spec

  6. #6


    Posts : 2,690
    Windows 3.1 > Windows 10


    is this is a bat or cmd file??

    you got comma's in one cmd - but not all

    I see what you trying to do

    you want to Select index 1 and then call next cmd

    Attachment 59177
      My System SpecsSystem Spec

  7. #7


    Posts : 2,690
    Windows 3.1 > Windows 10


    wmic nicconfig where Index=1 call SetTcpipNetbios where index=2

    wmic nicconfig where Index=1 call SetTcpipNetbios index=2


    Not sure of the command - new to me
      My System SpecsSystem Spec

  8. #8


    Posts : 70
    windows 8.1


    Quote Originally Posted by KYHI View Post
    wmic nicconfig where Index=1 call SetTcpipNetbios where index=2

    wmic nicconfig where Index=1 call SetTcpipNetbios index=2


    Not sure of the command - new to me
    I'll give it a whirl later and let you know tonight or tomorrow. Thanks!
      My System SpecsSystem Spec

  9. #9


    Posts : 70
    windows 8.1


    So the first command (get) gives you a menu basically, and you have to pick which device or adapter you want to set, so you would need a way to either 1) disable NetBIOS for all adapters, or 2) identify the specific gateway to the script before it runs. Might just be easier to do this one by hand. Sure would be nice to do all post install configuring with one .bat. I'll keep looking around, let me know if find anything; Thanks for the help!
      My System SpecsSystem Spec

  10. #10


    Posts : 70
    windows 8.1

    Solved


    So, this is actually easy enough, I just did this:

    wmic nicconfig where index=0 call SetTcpipNetbios 2
    wmic nicconfig where index=1 call SetTcpipNetbios 2
    wmic nicconfig where index=2 call SetTcpipNetbios 2
    wmic nicconfig where index=3 call SetTcpipNetbios 2
    wmic nicconfig where index=4 call SetTcpipNetbios 2
    wmic nicconfig where index=5 call SetTcpipNetbios 2
    wmic nicconfig where index=6 call SetTcpipNetbios 2


    Not very pretty, but it gets the job done.
      My System SpecsSystem Spec

Page 1 of 2 12 LastLast
Batch File Question
Related Threads
I'm trying to create a NETSH batch file that sets my TCP/IP settings to DHCP. The line I want to use is: netsh interface ipv4 set address name="My Custom Named Network" dhcp If I run the global cmd prompt and paste this line, it works as intended. However, if I create a batch file with the...
Need Batch File Help in General Support
First off, sorry if this is not posted in the right forum. I wasn't sure if it was more appropriate here or in the "Chillout Room" or elsewhere. I'm a noob when it comes to batch scripts, so I'd appreciate any help I could get. I tried doing all sorts of searches to find my answer (at least one...
I accidentally set the file open of .bat files to Notepad. From a link in this forum (How to Restore Default File Extension Type Associations in Windows 8 and 8.1)was able to reset the registry back I think. The bat file not longer asks for notepad but instead opens "How do you want to open this...
I need a way to play a video constantly all day, I found the following batch file which when edited for my video works perfectly in both Chrome and Firefox but does not work in Internet explorer(IE) Does any one have a solution for IE please. The Batch file is as follows:- <!DOCTYPE html> <html>...
If anyone is interested, I made a tutorial on using a batch file to run dism & sfc. https://www.eightforums.com/windows-updates-activation/40095-windows-update-wont-download-sfc-finds-corrupt-cant-fix-2.html#post336782 I hope it is useful to someone. :)
Solved Batch file question in General Support
Hi, I'm writing a small batch file, but it doesn't show everything. Can you help? @echo offsetLocal EnableDelayedExpansion pushd "C:\Users\%username%\Desktop" type nul > "%hostname% %username%" I also want to add IP-address (and maybe leave the username out).
Since Windows 8 is not creating System Restore points, apparently because I have a dual boot Windows 8 / Windows 7 setup, I'd like to schedule one every 3-4 days or so. Is there any way to run system restore from Command line or batch file or Powershell? If so then I could schedule it to run...
Eight Forums Android App Eight Forums IOS App Follow us on Facebook