[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 248
  • Last Modified:

Using a Network PAth as a Variable with the Shell function

Ok guys i know this is probably simple one, i just cant figure it out.

I'm using the shell function to run a third party utility called "psexec" to exectue programs on remote machines. I'm trying to find a way of setting the remote computer name as a variable, which is passed from a text box to a shell command, but i just cant get it too work. i've tried the following.

All i want is to pass a text box entry to the variable called "remotepc", which i can use the "shell" function.

Private Sub Command1_Click()

Dim remotepc as string
dim params as string

text1.text = remotepc
params = "-i -c -f -d \\Server1\test\client.exe"

Form1.Hide
Shell "\\server1\users\ribuck\everyone\Antivirus\psexec.exe" & remotepc & params

Unload Me

End Sub


0
ribuck
Asked:
ribuck
  • 2
1 Solution
 
Farzad AkbarnejadDeveloperCommented:
Hi,
Write  remotepc = text1.text   instead of   text1.text = remotepc  because you can assign value from textbox to remotepc.

-FA
0
 
Farzad AkbarnejadDeveloperCommented:
** because you want  ....   **

-FA
0
 
SethiCommented:
This is how you do it:

Private Sub Command1_Click()

Dim remotepc as string
dim params as string

remotepc = text1.text
params = "-i -c -f -d \\Server1\test\client.exe"

Form1.Hide
Shell "\\server1\users\ribuck\everyone\Antivirus\psexec.exe " & remotepc & " " & params

Unload Me

End Sub

0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now