Jump to content
Sign in to follow this  
Guest Coke

How to use Variables inside a Run command

Recommended Posts

Guest Coke

I have a script I wrote for generating network traffic. However I am having trouble using variables inside quotes. Perhaps someone could correct me.

Here is my script:

==================================

$answer = InputBox ( "How many Windows?", "Enter a Single Number", "1" )

$host = InputBox ( "Target?", "Enter a IP or valid host", "127.0.0.1" )

Do

Run ( 'ping -l 55500 -w 0 -t $host' )

$answer = $answer - 1

Until $answer = 0

Exit

===================================

How do I get the script to use the value of the variable? It takes it literally.

Thanks!

Coke

Share this post


Link to post
Share on other sites
Guest Coke

look up...  at the stickey...  it's a faq...  you read it before you post...  within you will find the answer.

9. Why can't I print a variable using "My var is $variable"?

Thank you for posting. I read the FAQ and perhaps I had made a syntax error, however, your suggestion is working for me. Revised code below.

Thanks.

=============================

$answer = InputBox ( "How many Windows?", "Enter a Single Number", "1" )

$host = InputBox ( "Target?", "Enter a IP or valid host", "127.0.0.1" )

Do

Run ( 'ping -l 55500 -w 0 -t ' & $host )

$answer = $answer - 1

Until $answer = 0

Exit

===================================

Thank you

Coke

Share this post


Link to post
Share on other sites
emmanuel

and there was much rejoycing... yay.

glad it worked out for ya. that one got me once too.

"I'm not even supposed to be here today!" -Dante (Hicks)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.