Solved

Using a Network PAth as a Variable with the Shell function

Posted on 2004-08-09
3
242 Views
Last Modified: 2010-05-02
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
Comment
Question by:ribuck
  • 2
3 Comments
 
LVL 14

Expert Comment

by:Farzad Akbarnejad
ID: 11751010
Hi,
Write  remotepc = text1.text   instead of   text1.text = remotepc  because you can assign value from textbox to remotepc.

-FA
0
 
LVL 14

Expert Comment

by:Farzad Akbarnejad
ID: 11751013
** because you want  ....   **

-FA
0
 
LVL 18

Accepted Solution

by:
Sethi earned 250 total points
ID: 11751217
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

680 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question