Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: catch an answer then get MAC  (Read 21699 times)

0 Members and 1 Guest are viewing this topic.

metal_man77

    Topic Starter


    Rookie
    • Yes
  • Computer: Specs
  • Experience: Experienced
  • OS: Windows 7
catch an answer then get MAC
« on: May 12, 2021, 02:51:03 PM »
Hello all, it's been a few years...

So, here's what I want to do :
Code: [Select]
@echo off
echo.
echo What is the name of the computer
(catch the computer name) >> ~%dp0\1.txt
getmac >> ~%dp0\1.txt
exit

The thing is that I don't know how to "catch" the answer.
My best guess is that there's a %1 somewhere to catch it...

Any help ?
Thanks

Hackoo



    Hopeful
  • Thanked: 42
  • Experience: Expert
  • OS: Windows 10
Re: catch an answer then get MAC
« Reply #1 on: May 12, 2021, 06:33:18 PM »
Did you mean this  ???
Code: [Select]
echo %ComputerName%

Squashman



    Specialist
  • Thanked: 134
  • Experience: Experienced
  • OS: Other
Re: catch an answer then get MAC
« Reply #2 on: May 12, 2021, 09:41:03 PM »
If you really want user input, that is done with the SET /P command.  You can read the help for the SET command by opening a command prompt and typing: set /?

metal_man77

    Topic Starter


    Rookie
    • Yes
  • Computer: Specs
  • Experience: Experienced
  • OS: Windows 7
Re: catch an answer then get MAC
« Reply #3 on: May 13, 2021, 08:28:27 AM »
@Hackoo, no, this gives me the computername already defined. This would be executed in a WinPE boot. So I can get the computername defined by the compagny, on the tag. Like it's not even built (imaged) yet ! ;)
@Suashman, so :
Code: [Select]
@echo off
echo.
set /p "input="Please enter the computer name and press Enter"
echo %input% >> ~%dp0\1.txt
getmac >> ~%dp0\1.txt
exit

then, I would have the result of "Input" in the txt file?

metal_man77

    Topic Starter


    Rookie
    • Yes
  • Computer: Specs
  • Experience: Experienced
  • OS: Windows 7
Re: catch an answer then get MAC
« Reply #4 on: May 13, 2021, 11:00:16 AM »
Sry, I can't edit the previous post...

So, tested and corrected some of my mistakes :
1. It's %~dp0, and not ~%...

The "getmac% gives me a lot of info... too much in fact :
Code: [Select]
Adresse physique    Nom du transport                                         
=================== ==========================================================
AA-BB-CC-DD-EE-FF   N/A 

is it possible to have "only" the mac address ?       

metal_man77

    Topic Starter


    Rookie
    • Yes
  • Computer: Specs
  • Experience: Experienced
  • OS: Windows 7
Re: catch an answer then get MAC
« Reply #5 on: June 05, 2021, 10:35:36 AM »
I've passed some switches to the getmac, it runs good in a windows installed machine... But I want to run it from a PE Environment

Code: [Select]
getmac /fo table /nh