1

I am aiming to create a batch file to place in user start menus. That will allow users to click and create a dialogue box that shows the IPv4 address of the computer they are using. This is needed because users are not able to access the command line as per policy restrictions. But they are still able to run batch files we place in their start menus.

So far I can use this command to get the IPv4 address: ipconfig | find /i "IPv4".

Also can use this command to get a dialogue box: msg %username% -text here-.

However, I am not able to get it to present the IPv4 in the dialogue box. Is there any way I can use the command line to present the IPv4 of a computer in a dialogue box?

Note: PowerShell has an absolute restriction so that is not an option.

  • 1
    Does this answer your question? [How to set commands output as a variable in a batch file](https://stackoverflow.com/questions/6359820/how-to-set-commands-output-as-a-variable-in-a-batch-file) – Squashman May 11 '21 at 13:29
  • I would recommend your company use the free utility from Microsoft called [BGINFO](https://learn.microsoft.com/en-us/sysinternals/downloads/bginfo). That is what our company uses in our US locations. We use it specifically for what you are trying to do. – Squashman May 11 '21 at 13:30
  • @Squashman, the thing is we are trying to move away from software dependencies. With the newly expanded work from home structure using software and utilities, that is the monitoring and controlling of these can be troublesome. We actually used to have VNC on the machines and now we have removed it due to what I mentioned. – Shemar Forsythe May 11 '21 at 15:38

1 Answers1

0
for /f "tokens=3 delims=: " %%i  in ('netsh interface ip show config name^="Ethernet" ^| findstr "IP Address"') do set ip=~%%i

mshta "about:<script>alert('%ip%');close()</script>"
npocmaka
  • 55,367
  • 18
  • 148
  • 187