Pass a text file through a batch file

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Nov 2008
Posts: 3
Reputation: hamidreza2790 is an unknown quantity at this point 
Solved Threads: 0
hamidreza2790 hamidreza2790 is offline Offline
Newbie Poster

Pass a text file through a batch file

 
0
  #1
Nov 4th, 2008
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.
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 65
Reputation: bushman_222 is an unknown quantity at this point 
Solved Threads: 4
bushman_222's Avatar
bushman_222 bushman_222 is offline Offline
Junior Poster in Training

Re: Pass a text file through a batch file

 
0
  #2
Nov 4th, 2008
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
  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.
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 3
Reputation: hamidreza2790 is an unknown quantity at this point 
Solved Threads: 0
hamidreza2790 hamidreza2790 is offline Offline
Newbie Poster

Re: Pass a text file through a batch file

 
0
  #3
Nov 4th, 2008
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.
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 65
Reputation: bushman_222 is an unknown quantity at this point 
Solved Threads: 4
bushman_222's Avatar
bushman_222 bushman_222 is offline Offline
Junior Poster in Training

Re: Pass a text file through a batch file

 
0
  #4
Nov 5th, 2008
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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum


Views: 1738 | Replies: 3
Thread Tools Search this Thread



Tag cloud for Visual Basic 4 / 5 / 6
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC