Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - passing batch input to vbs

Reply
 
Old 05-08-2009   #1 (permalink)
tree leafs


 
 

passing batch input to vbs

Hi,
I tried to run a batch file like this:
set /p var = please enter the value:
cscript test.vbs "%var%"

the test.vbs can be run successfully by its own, but when it runs within
this batch file it could not get the value from the input.
what it the proper syntax to pass on the value from the set /p command?
thanks



My System SpecsSystem Spec
Old 05-08-2009   #2 (permalink)
Pegasus [MVP]


 
 

Re: passing batch input to vbs


"tree leafs" <treeleafs@xxxxxx> wrote in message
news:%235URFO7zJHA.3476@xxxxxx
Quote:

> Hi,
> I tried to run a batch file like this:
> set /p var = please enter the value:
> cscript test.vbs "%var%"
>
> the test.vbs can be run successfully by its own, but when it runs within
> this batch file it could not get the value from the input.
> what it the proper syntax to pass on the value from the set /p command?
> thanks
Try this instead:
set /p var=please enter the value
echo You entered %var%
pause

This is not a VB parameter problem but a batch file problem: The extra
spaces you added had an effect that you probably did not anticipate.


My System SpecsSystem Spec
Old 05-08-2009   #3 (permalink)
tree leafs


 
 

Re: passing batch input to vbs

Thanks! I realised that soon after.
There should be no space between var and =


"Pegasus [MVP]" <news@xxxxxx> wrote in message
news:e87MYb7zJHA.1196@xxxxxx
Quote:

>
> "tree leafs" <treeleafs@xxxxxx> wrote in message
> news:%235URFO7zJHA.3476@xxxxxx
Quote:

>> Hi,
>> I tried to run a batch file like this:
>> set /p var = please enter the value:
>> cscript test.vbs "%var%"
>>
>> the test.vbs can be run successfully by its own, but when it runs within
>> this batch file it could not get the value from the input.
>> what it the proper syntax to pass on the value from the set /p command?
>> thanks
>
> Try this instead:
> set /p var=please enter the value
> echo You entered %var%
> pause
>
> This is not a VB parameter problem but a batch file problem: The extra
> spaces you added had an effect that you probably did not anticipate.
>

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Just passing along some information Vista mail
Passing of variables VB Script
passing whole objects PowerShell
Chinese Traditional Input using Phonetic Input Vista General
Passing Validation Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46