Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Using a Network PAth as a Variable with the Shell function

Posted on 2004-08-09
3
Medium Priority
?
247 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 1000 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

772 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