|
-
Aug 28th, 2007, 01:46 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] command line arguments
i think these are command line arguments, im not sure:
prog1.exe /s /?
Id like to know how to code some into my program? Please leave a link that explains them and shows how to implement them.
thanks in advance chris1990
If your question is answered then mark your thread RESOLVED and give credit to whoever answered it.
If you fail, try and try again, its the only way to success.
-
Aug 28th, 2007, 01:51 PM
#2
Re: command line arguments
What specific arguments are you interested in?
-
Aug 28th, 2007, 01:54 PM
#3
Thread Starter
Hyperactive Member
Re: command line arguments
I've read somewhere a few months ago that you can run parts of your code by using arguments. So parts of code in my program.
If your question is answered then mark your thread RESOLVED and give credit to whoever answered it.
If you fail, try and try again, its the only way to success.
-
Aug 28th, 2007, 02:03 PM
#4
Member
Re: command line arguments
Yes, if you call your program from command prompt and you pass arguments as such:
prog1.exe argument
then the argument is automatically saved in vb as the constant variable: Command. So, if you want your msgbox.exe program to message whatever you type in as an argument then this would be the program:
vb Code:
Private Sub Form_Load()
Dim sCmd As String
sCmd = Command
MsgBox sCmd
Unload Me
End Sub
-
Aug 28th, 2007, 02:13 PM
#5
Thread Starter
Hyperactive Member
Re: command line arguments
My program is close.exe it has subs which include restart, log off, shutdown. I was hoping to run the subs in the program from another so i could use something likethis to restart the PC:
vb Code:
Shell "close.exe /restart"
If your question is answered then mark your thread RESOLVED and give credit to whoever answered it.
If you fail, try and try again, its the only way to success.
-
Aug 28th, 2007, 02:23 PM
#6
Re: command line arguments
Assume that this is your program
Code:
Option Explicit
Private Sub Form_Load()
CallByName Me, Command, VbMethod
End Sub
Public Sub restart()
MsgBox "restart"
End Sub
Public Sub shutdown()
MsgBox "shutdown"
End Sub
Then from a program
Shell "C:\temp\project1.exe restart"
or from Start|Run you could do
C:\temp\project1.exe restart
-
Aug 28th, 2007, 02:29 PM
#7
Thread Starter
Hyperactive Member
Re: command line arguments
If your question is answered then mark your thread RESOLVED and give credit to whoever answered it.
If you fail, try and try again, its the only way to success.
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
|