How do I execute an .exe file using VB code?
Printable View
How do I execute an .exe file using VB code?
Use Shell function
I think Shell and API ways are old stuff to run exe . anyways , here's .NET way :DQuote:
Originally posted by Lunatic3
Use Shell function
try it ...VB Code:
System.Diagnostics.Process.Start("notepad.exe")
Thanks Pirate.
Shell synstax is :
Public Function Shell( _
ByVal Pathname As String, _
Optional ByVal Style As AppWinStyle = AppWinStyle.MinimizedFocus, _
Optional ByVal Wait As Boolean = False, _
Optional ByVal Timeout As Integer = -1 _
) As Integer
Is there an easy way to define optional arguments of Shell- Style,Wait and Timeout- for Process.Start ?
i have a arj.exe file
my command is
arj a a:test c:test.mdb -va -y
how do i insert this arguments in the vb code?
System.Diagnostics.Process.Start has an overloaded version that takes filename and argument.
ex:
Code:System.Diagnostics.Process.Start("arj.exe", "-va -y")
Isn't this func from VB6 ?I mean API:D ?Quote:
Originally posted by Lunatic3
Thanks Pirate.
Shell synstax is :
Public Function Shell( _
ByVal Pathname As String, _
Optional ByVal Style As AppWinStyle = AppWinStyle.MinimizedFocus, _
Optional ByVal Wait As Boolean = False, _
Optional ByVal Timeout As Integer = -1 _
) As Integer
Is there an easy way to define optional arguments of Shell- Style,Wait and Timeout- for Process.Start ?
I've used this code, but only command prompt opened and file was not copy into the a:Quote:
Originally posted by Athley
System.Diagnostics.Process.Start has an overloaded version that takes filename and argument.
ex:
Code:System.Diagnostics.Process.Start("arj.exe", "-va -y")
System.Diagnostics.Process.Start("c:arj.exe", " a a:test c:test.mdb -va -y")
The argument part of the start method should not include the preceding space. Try...Quote:
Originally posted by chinhow
I've used this code, but only command prompt opened and file was not copy into the a:
System.Diagnostics.Process.Start("c:arj.exe", " a a:test c:test.mdb -va -y")
As it is an argument it presumes it should be a space and adds one itself.Code:System.Diagnostics.Process.Start("c:\arj.exe", "a a:test c:\test.mdb -va -y")
format:
Shell("C:\program.exe")
Easy as 123
yes, i tried System.Dianostics.Process.Start("C:\arj.exe", "a a:test C:\test.mdb -va -y") BUT it won't treat the latter as the arguments. In other words, the exe is doing nothing but just open the command prompt and close it without execute the file copy.....Quote:
Originally posted by Athley
The argument part of the start method should not include the preceding space. Try...
As it is an argument it presumes it should be a space and adds one itself.Code:System.Diagnostics.Process.Start("c:\arj.exe", "a a:test c:\test.mdb -va -y")
Try this :D
VB Code:
Dim p As New Process() p.StartInfo.FileName = "arj.exe" p.StartInfo.Arguments = "a a:test c:\test.mdb -va -y" p.Start()
Thanks, It's worked!!!!Quote:
Originally posted by DevGrp
Try this :D
VB Code:
Dim p As New Process() p.StartInfo.FileName = "arj.exe" p.StartInfo.Arguments = "a a:test c:\test.mdb -va -y" p.Start()
But why the command prompt didn't display the progress ?