943,840 Members | Top Members by Rank

Ad:
Nov 4th, 2008
0

Pass a text file through a batch file

Expand Post »
Hi
I run a batch file by VB6. The bach file need to pass a text file and a string (such as abc).
I used the following commands but I faced errors :

Shell "n:\aa.bat " & "c:\a1.txt" & "abc " , vbNormalFocus

Shell "n:\aa.bat " & " " & "c:\a1.txt" & " " & "abc" , vbNormalFocus

What is the command for doing that?
Last edited by hamidreza2790; Nov 4th, 2008 at 6:49 am.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
hamidreza2790 is offline Offline
3 posts
since Nov 2008
Nov 4th, 2008
0

Re: Pass a text file through a batch file

I'm not sure on what you are after. Do you require

1.) the instructions on how to accept the inputs with the batch file
Any arguments for the batch file are saved as % then a number. The first argument is always %1, the second is %2, the third is %3 etc

or

2.)How to add the batch file arguments on the end of the line while in VB?

I added this line in VB
VB Syntax (Toggle Plain Text)
  1. Call Shell("c:\test.bat" & " " & "one two tree", vbNormalFocus)

and that worked fine
Last edited by bushman_222; Nov 4th, 2008 at 11:37 am.
Reputation Points: 10
Solved Threads: 4
Junior Poster in Training
bushman_222 is offline Offline
65 posts
since Jan 2008
Nov 4th, 2008
0

Re: Pass a text file through a batch file

thank you very much for your attention

The batch file that I use, need to pass a text file.
In the ther other word after running batch file , the path of input data file (text file) should be entered.
I used the following command but It just run the batch file without reading data file.

Call Shell("c:\test.bat" & " " & "c:\x1.dat", vbNormalFocus)

What would be the command to run a batch file and read data file?
Last edited by hamidreza2790; Nov 4th, 2008 at 12:54 pm.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
hamidreza2790 is offline Offline
3 posts
since Nov 2008
Nov 5th, 2008
0

Re: Pass a text file through a batch file

so you want to pass a varable (file path) to a batch file.

I can't see anything wrong with your code.

Lets see if the information is getting into the batch file, Create a new batch file and call it test1.bat and enter the following

@echo input 1 %1
pause

See what happens with that
Reputation Points: 10
Solved Threads: 4
Junior Poster in Training
bushman_222 is offline Offline
65 posts
since Jan 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Problem in form resize
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: code to delete *.tmp file in vb6





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC