1

I need to pass argument from wsf file to bat file to windows command script. In wsf file I have:

Shell.Run("Something.bat ",&varparam,1,true)

In Something.bat:

sftp.exe testcommand.cmd %1

In testcommand.cmd:

open user@address
put %1

But .cmd file does not get access to the parameter value. How can I get this to work?

1 Answer 1

1

In order to pass values into a batch you can use call Try this:

CALL Something.bat %varparam%

And I think part of your problem is that you are trying to pass values into a command file that is already part of a separate string.

You could get this to work by haveing your Something.bat create your testcommand file. Something.bat:

echo open user@address testcommand.bat
echo put %1 >> testcommand.bat

sftp.exe -b testcommand.bat

It's not perfect but I'm pretty sure the syntax of

sftp.exe testcommand.cmd %variable%

is your problem.

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.