Jump to content

How to use Variables inside a Run command


Guest Coke
 Share

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

Link to comment
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

Link to comment
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
 Share

  • Recently Browsing   0 members

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