By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,646 Members | 2,105 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,646 IT Pros & Developers. It's quick & easy.

parameter passing to EXE file and reading the parameter inside the EXE

P: 2
How to make a EXE file to accept the parameter values passed from the command line and how to read back the passed parameter values

help required urgently
Nov 17 '06 #1
Share this Question
Share on Google+
5 Replies


Expert 5K+
P: 8,434
How to make a EXE file to accept the parameter values passed from the command line and how to read back the passed parameter values

help required urgently
Try looking at the value in Command$
Nov 17 '06 #2

100+
P: 267
Try looking at the value in Command$
hi

or

Argument=Command()
Nov 17 '06 #3

P: 2
hi

or

Argument=Command()
can u provide any live working sample please
Nov 17 '06 #4

100+
P: 267
can u provide any live working sample please

hi there

place following in your Form_Load()
call the Form : Form1
place a textbox (select multiline=true) calles Text1
drag a textfile on top of the program's icon (after compiling an exe)

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub Form_Load()
  3. On Error GoTo fail
  4. 'see if the program was opened with an argument...
  5. FileName = Command()
  6. If Not FileName = vbNullString Then
  7.     Open FileName For Input As #1
  8.         Line Input #1, p
  9.         Form1.Text1.Text = p
  10.         While Not EOF(1)
  11.         Line Input #1, p
  12.         Form1.Text1.Text = Form1.Text1.Text & vbCrLf & p
  13.         Wend
  14.     Close #1
  15. End If
  16. End Sub
  17.  
  18.  
Nov 17 '06 #5

100+
P: 267
hi there

place following in your Form_Load()
call the Form : Form1
place a textbox (select multiline=true) calles Text1
drag a textfile on top of the program's icon (after compiling an exe)

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub Form_Load()
  3. On Error GoTo fail
  4. 'see if the program was opened with an argument...
  5. FileName = Command()
  6. If Not FileName = vbNullString Then
  7.     Open FileName For Input As #1
  8.         Line Input #1, p
  9.         Form1.Text1.Text = p
  10.         While Not EOF(1)
  11.         Line Input #1, p
  12.         Form1.Text1.Text = Form1.Text1.Text & vbCrLf & p
  13.         Wend
  14.     Close #1
  15. End If
  16. End Sub
  17.  
  18.  
need to put

Fail:

just before End Sub !
Nov 17 '06 #6

Post your reply

Sign in to post your reply or Sign up for a free account.