Passing Parameters from external process
Posted: 12 Aug 2010 02:56
Hi
I wonder whether anyone can give me some pointers on the following scenario. I have an external process which captures a UK postcode as a variable, and I want to pass that into a bat file as a variable. The UK postcode format is of the format A1 1AA, and that is the variable (sPostcode) captured in the external process.
When I pass "C:\Application\mi_process.bat " + sPostcode
and in the bat file use
echo %1
I am returned with just the first portion of the postcode - i.e. A1
I have tried "C:\Application\mi_process.bat " + chr$(34) + sPostcode + chr$(34)
And the echo %1 returns
"A1 1AA"
which appears to be nearly there, but I don't want the variable to store the quotes.
I can use %* in the original and it returns the full postcode but want to be able to keep postcodes referenced by separate %n variables so that I can extend functionality to include passing numerous postcodes.
So I guess the more simplistic question is where I am passing a variable like this:
c:\application\mi_process.bat 1 2
what do I need to do to read 1 2 as a single variable (i.e. %1)
Any ideas?
I wonder whether anyone can give me some pointers on the following scenario. I have an external process which captures a UK postcode as a variable, and I want to pass that into a bat file as a variable. The UK postcode format is of the format A1 1AA, and that is the variable (sPostcode) captured in the external process.
When I pass "C:\Application\mi_process.bat " + sPostcode
and in the bat file use
echo %1
I am returned with just the first portion of the postcode - i.e. A1
I have tried "C:\Application\mi_process.bat " + chr$(34) + sPostcode + chr$(34)
And the echo %1 returns
"A1 1AA"
which appears to be nearly there, but I don't want the variable to store the quotes.
I can use %* in the original and it returns the full postcode but want to be able to keep postcodes referenced by separate %n variables so that I can extend functionality to include passing numerous postcodes.
So I guess the more simplistic question is where I am passing a variable like this:
c:\application\mi_process.bat 1 2
what do I need to do to read 1 2 as a single variable (i.e. %1)
Any ideas?