1

I want to check Edge webdriver version using batch file. The name of the webdriver is msedgedriver.exe and I can check the version using this command manually.

msedgedriver.exe -v

And the output is

MSEdgeDriver 96.0.1054.62 (f97cb2ce0103f6eaa6dc1994d77748c659744916)

But when I use batch for to get the output, it shows nothing. The batch code:

FOR /F "tokens=* USEBACKQ" %%F IN ('msedgedriver.exe -v') DO (
SET var=%%F
)
ECHO %var%

I've tried every answer in How to set commands output as a variable in a batch file link. I've checked the file path and it's correct. and tried 'call "msedgedriver.exe -v"' or 'msedgedriver.exe /v' or every other combination.

8
  • Are you running the batch from within the same folder as of where msedgedriver.exe is located? Otherwise you would have to provide the full path to msedgedriver.exe Commented Dec 24, 2021 at 9:55
  • Yes, I'm sure about that, I've tried the full path and it didn't work.
    – Ali Ent
    Commented Dec 24, 2021 at 9:57
  • Can you provide the location for testing I didn't find it? Commented Dec 24, 2021 at 10:02
  • Sorry I didn't understand exactly about > provide the location. this is the full path "C:\Users\alient\Documents\Pycharm Projects\bot_onnx\msedgedriver.exe" and this the bat file path "C:\Users\alient\Documents\Pycharm Projects\bot_onnx\check_version.bat"
    – Ali Ent
    Commented Dec 24, 2021 at 10:10
  • Ah ok, I figured out this is not included by default in Windows... Commented Dec 24, 2021 at 10:11

1 Answer 1

2

I suspect that because the output has parentesis "()" you would have to use some extra quotes:

@echo off
FOR /F "tokens=2" %%F IN ('"msedgedriver.exe -v"') DO SET var=%%F

echo %var%
pause

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .