I have written a batch file that runs a vbscript and then collects the values from the vbscrit for further process.
This is my code:
myBatch.bat
@ECHO OFF
setlocal EnableDelayedExpansion
REM ECHO ============= RUNNING BATCH =============
ECHO.
for /F "delims=" %%a in ('CSCRIPT C:\myVBScript.vbs') do (
ECHO RESULT: %%a
)
REM ECHO ============= FINNISHED BATCH =============
ECHO.
myVBScript.vbs
Option Explicit
Dim values, splitStr
'ask for value
values=InputBox("Please provide a list separated by semicolon","Do stuff","item1;item2")
splitStr=Split(values,";")
If UBound(splitStr) >= 1 Then
WScript.Echo splitStr(0)
WScript.Echo splitStr(1)
End If
And this is the output:
RESULT: Microsoft (R) Windows Script Host Version 5.8
RESULT: Copyright (C) Microsoft Corporation. All rights reserved.
RESULT: item1
RESULT: item2
Where does the two first lines come from and how can I avoid them? This is very annoing and I cant figure out how to just get the actual values (item1 and item2).
skipparamter tofor, like infor /F "skip=2 delims=" %%a in ...