ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   executing batch files using VBA (https://www.excelbanter.com/excel-programming/359453-executing-batch-files-using-vba.html)

srkumar

executing batch files using VBA
 

Hi,

I would like to accomplish the following and appreciate any advice. I
would like to create a loop using VBA that repeatedly executes a batch
file for different parameters. i tried the shell command: shell
("cmd.exe D:\abc\test.bat") but keep getting the msg.:
"cmd.exe was started with 'D:\abc' as the current directory path. UNC
paths are not supported. Defaulting to windows directory" and each time
the system returns to C:\WINNT.

is there a way around this that allows me to execute batch files that
are located in drives other than C:?


--
srkumar
------------------------------------------------------------------------
srkumar's Profile: http://www.excelforum.com/member.php...o&userid=20037
View this thread: http://www.excelforum.com/showthread...hreadid=534991


Don Guillett

executing batch files using VBA
 
have a look in vba help for
chdir

--
Don Guillett
SalesAid Software

"srkumar" wrote in
message ...

Hi,

I would like to accomplish the following and appreciate any advice. I
would like to create a loop using VBA that repeatedly executes a batch
file for different parameters. i tried the shell command: shell
("cmd.exe D:\abc\test.bat") but keep getting the msg.:
"cmd.exe was started with 'D:\abc' as the current directory path. UNC
paths are not supported. Defaulting to windows directory" and each time
the system returns to C:\WINNT.

is there a way around this that allows me to execute batch files that
are located in drives other than C:?


--
srkumar
------------------------------------------------------------------------
srkumar's Profile:
http://www.excelforum.com/member.php...o&userid=20037
View this thread: http://www.excelforum.com/showthread...hreadid=534991




Jim Thomlinson

executing batch files using VBA
 
A batch file is an executable file. Why do you have cmd.exe preceding the
batch file. Shouldn't it be just...

shell ("D:\abc\test.bat")
--
HTH...

Jim Thomlinson


"srkumar" wrote:


Hi,

I would like to accomplish the following and appreciate any advice. I
would like to create a loop using VBA that repeatedly executes a batch
file for different parameters. i tried the shell command: shell
("cmd.exe D:\abc\test.bat") but keep getting the msg.:
"cmd.exe was started with 'D:\abc' as the current directory path. UNC
paths are not supported. Defaulting to windows directory" and each time
the system returns to C:\WINNT.

is there a way around this that allows me to execute batch files that
are located in drives other than C:?


--
srkumar
------------------------------------------------------------------------
srkumar's Profile: http://www.excelforum.com/member.php...o&userid=20037
View this thread: http://www.excelforum.com/showthread...hreadid=534991




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

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