|
-
Sep 4th, 2002, 10:40 AM
#1
Thread Starter
New Member
Shell command
I'm tring to get a shell to execute a command line program and pass a string in "quotes" and not having any luck. Here is the line of code in question:
exec = Shell ("C:\program.exe -options") & strText
It will execute the program but it doesn't send the string with the "quotes". It needs to executes this:
c:\program.exe -options "needs to be the value of strText in quotes"
TIA,
Chris
-
Sep 4th, 2002, 10:50 AM
#2
PowerPoster
exec = Shell ("C:\program.exe " & strText)
-
Sep 4th, 2002, 10:51 AM
#3
PowerPoster
or, with "-options" included,
exec = Shell ("C:\program.exe -options " & strText)
-
Sep 4th, 2002, 10:54 AM
#4
Addicted Member
Try this, it'll work for launching any EXE and associated file...
VB Code:
'in a module
Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
'in your code
Call ShellExecute(hwnd, "Open", <your path>, <your command line params>, App.Path, 1)
If you can think it....you can code it....
-
Sep 4th, 2002, 10:54 AM
#5
Need-a-life Member
I think he needs:
VB Code:
exec = Shell ("C:\program.exe -options " & """" & strText & """")
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
Sep 4th, 2002, 11:01 AM
#6
Fanatic Member
I'm with mcbrain.
a quick little debug trick is to "string up" your shell call.
this way you can check it in it's entirety just before it runs...
VB Code:
MyCompleteShellString = "C:\myprogram.exe -options""" & strtext & """"
Shell MyCompleteShellString
-
Sep 4th, 2002, 11:59 AM
#7
Thread Starter
New Member
Well, I thank you all for the input. I tried JPicasso suggesttion and it works flawlessly.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|