@echo off for /f "tokens=* usebackq" %%a in ( `cscript //nologo "%~f0?.wsf" //job:fileVersion "%windir%\System32\termsrv.dll"` ) do ( set termsrv_dll_ver=%%a ) if "%termsrv_dll_ver%"=="" ( echo off [x] Error on getting the file version of "%windir%\System32\termsrv.dll"^^! goto :finish ) else ( echo %termsrv_dll_ver%) pause --- Begin wsf script --- fileVersion/fileDownload ---> pause