Phreak Posted January 2, 2003 Posted January 2, 2003 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! Quote If it works... don't worry, I'll fix it.
*Experts* Volte Posted January 2, 2003 *Experts* Posted January 2, 2003 Process.Start("C:\Program Files\Whatever\Blah.exe") Quote
*Experts* Bucky Posted January 2, 2003 *Experts* Posted January 2, 2003 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] Quote "Being grown up isn't half as fun as growing up These are the best days of our lives" -The Ataris, In This Diary
Phreak Posted January 2, 2003 Author Posted January 2, 2003 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") Quote If it works... don't worry, I'll fix it.
Phreak Posted January 2, 2003 Author Posted January 2, 2003 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? Quote If it works... don't worry, I'll fix it.
Phreak Posted January 2, 2003 Author Posted January 2, 2003 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. Quote If it works... don't worry, I'll fix it.
*Gurus* divil Posted January 2, 2003 *Gurus* Posted January 2, 2003 Try enclosing the file path part of the arguments in double quotes. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
*Experts* Volte Posted January 3, 2003 *Experts* Posted January 3, 2003 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. Quote
Phreak Posted January 3, 2003 Author Posted January 3, 2003 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. Quote If it works... don't worry, I'll fix it.
Phreak Posted January 3, 2003 Author Posted January 3, 2003 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! Quote If it works... don't worry, I'll fix it.
*Gurus* divil Posted January 3, 2003 *Gurus* Posted January 3, 2003 If all else fails, you can use the GetShortPathName API to get the path in 8.3 format, which will definitely work. As far as I know, this API isn't wrapped in the framework. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
vidiware Posted January 6, 2003 Posted January 6, 2003 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) Quote
*Gurus* divil Posted January 6, 2003 *Gurus* Posted January 6, 2003 URL-Encoding a windows path is not going to help :) Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
gs_london Posted May 1, 2003 Posted May 1, 2003 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 Quote
*Gurus* divil Posted May 1, 2003 *Gurus* Posted May 1, 2003 Environment.CommandLine Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
gs_london Posted May 2, 2003 Posted May 2, 2003 Thanks Divil (Is there anything you dont know?) :) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.