ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Executing a .BAT file using excel macro (https://www.excelbanter.com/excel-discussion-misc-queries/446079-executing-bat-file-using-excel-macro.html)

Vasanth

Executing a .BAT file using excel macro
 
HI

I have a .bat file which downloads a Mainframe file into a text file through FTP into my local machine.I need to execute this .bat file through excel vba. I tried the below shell script commands.

sYourCommand = "C:\Documents and Settings\FTP\mtc\extract.bat"
x = Shell("cmd.exe /c " & sYourCommand, 1)

The command window opens but the file is not downloaded.

when i execute the .bat file manually i get the files downloaded. Please help me to excute this .bat file throough excel vba.


Below details may help

the .bat file command ---------- ftp -s:file1.txt 192.74.252.153
file1.txt ( in the same location as .bat file )contains the user credentials and mainframe and local file name details.
as below

k9999
tda1234
get 'PJJJ.NVS.PJJJDSLA.SLARRRD.JJJ(0)' sla.txt

James Ravenswood

Executing a .BAT file using excel macro
 
On Thursday, May 17, 2012 5:57:24 AM UTC-4, Vasanth wrote:
HI

I have a .bat file which downloads a Mainframe file into a text file
through FTP into my local machine.I need to execute this .bat file
through excel vba. I tried the below shell script commands.

sYourCommand = "C:\Documents and Settings\FTP\mtc\extract.bat"
x = Shell("cmd.exe /c " & sYourCommand, 1)

The command window opens but the file is not downloaded.

when i execute the .bat file manually i get the files downloaded. Please
help me to excute this .bat file throough excel vba.


Below details may help

the .bat file command ---------- ftp -s:file1.txt 192.74.252.153
file1.txt ( in the same location as .bat file )contains the user
credentials and mainframe and local file name details.
as below

k9999
tda1234
get 'PJJJ.NVS.PJJJDSLA.SLARRRD.JJJ(0)' sla.txt




--
Vasanth


Consider putting a
pause
at the end of the bat file

That way you can see what is going on.


All times are GMT +1. The time now is 11:28 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com