Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Is there a way to launch an external application without using SHELL? Because when I use shell I have to use the 8 char format, e.g. "C:\Progra~1\.....".

 

When I want to be able to use Application.StartupPath which would return "C:\Program Files\....". Please help!

If it works... don't worry, I'll fix it.
  • *Experts*
Posted

To get the application's path, you can use a combination of

Application.ExecutablePath and the GetDirectoryName method

of the Path class.

 

Dim appPath As String

appPath = Path.GetDirectoryName(Application.ExecutablePath)

 

[edit]Or use Application.StartupPath... Sorry, missed that part of the post.:o [/edit]

"Being grown up isn't half as fun as growing up

These are the best days of our lives"

-The Ataris, In This Diary

Posted

How do I use switches with that? Say I want to run a SQL script when I start it. It doesn't like what I have below.

 

Process.Start("C:\ORANT\BIN\PLUS80W.EXE @ " & Application.StartupPath & "\seedlistp1.sql")

If it works... don't worry, I'll fix it.
Posted
Well, I found out how to enter arguments in with the PROCESS.START. However, it still wants to use the 8.3 format for the arguments. Any help? Ideas?
If it works... don't worry, I'll fix it.
Posted
No... I don't think it's using the 8.3 format, it just stops truncates it when it comes acrossed a SPACE in the folder name.
If it works... don't worry, I'll fix it.
  • *Experts*
Posted

Just to clear up what divil is saying, most programs, when they accept

command line arguments, require quotes around the arguments if

they are multi-worded.

 

For example, in the command prompt, to change directories, you

type cd "C:\Program Files\Microsoft Visual Studio .NET", otherwise,

it will take you to C:\Program if it exists.

 

To open a file in notepad, it might be

notepad.exe "C:\Documents And Settings\Joe\My Documents\notes.txt".

 

So your line might be like this:

Process.Start("C:\ORANT\BIN\PLUS80W.EXE", "@ """ & Application.StartupPath & "\seedlistp1.sql""")

No guarantees that it will work though, of course.

 

BTW, the double quotes are just because you need to use two to

tell the compiler that you're inserting quotes into a string and not

just ending the string. It's like \" in C.

Posted
No dice. This is REALLY agrivating! I thought that last option would have worked, and I can't believe I didn't think of that. Any other ideas? Because now, I"m really stumped.
If it works... don't worry, I'll fix it.
Posted

GOT IT!

 

Process.Start("C:\ORANT\BIN\PLUS80W.EXE", "@ '" & Application.StartupPath & "\seedlistp1.sql'")

 

Thanks for all your help and getting me on the right track. However, the program SQL Plus 8, only allows for 79 characters in the argument. But it will work from the Program Files distribution folder so that's all that matters. Thanks again!

If it works... don't worry, I'll fix it.
Posted

Im a newbie, and its not tested... but HTML urls often use keys like this %2 g% and something for spesial keys liek norwegian ø

 

I think space is %20 or 20% try to use that instead of ' ' (space)

  • 3 months later...
Posted

Just following on with this thread - How do you collect the arguments in VB.NET (command$ in vb 6)

 

========

System.Diagnostics.Process.Start("foo.exe", "test")

========

 

I need the string value of test within the foo executable

 

Cheers

gs

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...