Solved

extracting characters from either command line or text file

Posted on 2004-08-20
2
179 Views
Last Modified: 2010-04-13
I am using the getmac command with the /nh, to ignore the header to get the mac address from a computer.  I want to grab just the mac address and not the rest of the line that the getmac /nh command returns.

1.What I am trying to do is to use the getmac /nh command to get the mac address.
2.  Extract just the first 17 characters which makes up the address and save to a text file.
3.  Then I need to learn how to insert that address into a linksys wireless routers wireless mac address table.  Is that possible?

I used

getmac /nh > C"\mactest.txt

this sends the macaddress along with other info I dont need to a text file, but i cant get any farther.

Thanks,
Derek
0
Comment
Question by:dwarner8
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 84

Accepted Solution

by:
oBdA earned 250 total points
ID: 11851291
This will get you the first MAC address listed into the variable MAC.

@echo off
setlocal enabledelayedexpansion
set MAC=
for /f "tokens=1" %%a in ('getmac /nh') do if "!MAC!"=="" set MAC=%%a
echo MAC: [%MAC%]

As to getting that into your router, well, that depends on how you can access the router.
0
 
LVL 1

Author Comment

by:dwarner8
ID: 11851531
Thanks for the help.  I modified the line to pipe to a txt file.

echo %MAC%  > C:\macadd.txt

Now I just need to figure out how to write a program to take this mac address in a txt file and add it to a wireless linksys routers allowed mac address table automatically.

Step one complete,

Thanks,

Derek
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Windows 2000 Sever Lab Setup 1 703
cant not receive emails, due to low disk space. 16 274
Windows 16 363
how to run this deletion request 4 46
NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
After hours on line I found a solution which pointed to the inherited Active Directory permissions . You have to give/allow permissions to the "Exchange trusted subsystem" for the user in the Active Directory...
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question