0

I have a vbs file which will pass 3 parameters to test.bat.

The parameter is as below

test.bat "zz\zz\xyz" "Messagename" "Link"

The batch code is

@ECHO OFF
Echo %1
Echo %2
Echo %3
H:
cd "%1"

SET i=1
for %%f in (Plaintext*.xml) do call :CURL "%%f"
GOTO DONE

:CURL
Echo Success
PAUSE:
curl -X POST  --insecure --data-urlencode xmlInput@Plaintext%i%.xml "%2" >>"%3" 2>&1
PAUSE:
set /A i+=1

:DONE

PAUSE:

Issue: The curl command is failing as the parameter is not passing properly. But when capture the parameter in ECHO, all looks ok.. Dont know where the issue is. Can you please help?

1 Answer 1

1

You're only passing the filename to your :CURL function. You need to pass the other parameters as well.

 for %%f in (Plaintext*.xml) do call :CURL "%%f" "%~2" "%~3"
 Goto Done

 :CURL
 Echo Success
 Pause

 curl -X POST  --insecure --data-urlencode xmlInput@%~1 "%~2" >>"%~3" 2>&1
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.