Jump to content

Recommended Posts

Guest Coke
Posted

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

Guest Coke
Posted

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

Posted

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)

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...