Jump to content

How do I pass along stored info?


Recommended Posts

Hello all,

I've started writing a script to help manage the remote desktop connections we make a work a little easier. I'm starting out the script small, but hoping to learn enough to make it somewhat advanced.

For now, I'm having an issue. Here's the script:

$svrip = InputBox ("Question", "Enter the IP of the server")
Run("mstsc.exe /V:") 
Exit

The first line asks for the IP address of the server (which I hope to later be able to select from a list). In the second line, mstsc is the executable for remote desktop. the /V: command is supposed to be followed by the IP address of the server. My issue is I don't know how to pass along that info. I've tried

Run("mstsc.exe /V:$svrip")
, but it doesn't seem to like that. I've also tried
Run("mstsc.exe /V:")$svrip
, but it doesn't like that either.

How can I pass along the IP address to the switch for the remote desktop connection?

TIA

Sloppy

Link to comment
Share on other sites

Hello all,

I've started writing a script to help manage the remote desktop connections we make a work a little easier. I'm starting out the script small, but hoping to learn enough to make it somewhat advanced.

For now, I'm having an issue. Here's the script:

$svrip = InputBox ("Question", "Enter the IP of the server")
Run("mstsc.exe /V:") 
Exit

The first line asks for the IP address of the server (which I hope to later be able to select from a list). In the second line, mstsc is the executable for remote desktop. the /V: command is supposed to be followed by the IP address of the server. My issue is I don't know how to pass along that info. I've tried

Run("mstsc.exe /V:$svrip")
, but it doesn't seem to like that. I've also tried
Run("mstsc.exe /V:")$svrip
, but it doesn't like that either.

How can I pass along the IP address to the switch for the remote desktop connection?

TIA

Sloppy

Run("mstsc.exe /V:" & $svrip)
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

I tried looking but couldn't find it. So that I know for future reference, where is it located in the help file?

You should read the section on operators, strings, and variables. The problem is not how to use Run(), but how to assemble the string. The part you were missing was how to use '&' to put a literal string and a variable together. It won't take long with using Run() before you are going to want to include literal single and double quotes in the command line you are passing. A good grip on how to assemble string variables will serve you well.

:shocked:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...