Reputation: 990
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?
Upvotes: 1
Views: 1432
Reputation: 706
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.
Upvotes: 1