有理由赞成直接在A97 VBA中调用批处理文件VS运行CMD吗? [英] Any reason to favor calling a batch file VS running a CMD directly in A97 VBA?

查看:65
本文介绍了有理由赞成直接在A97 VBA中调用批处理文件VS运行CMD吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为GetConf.bat的批处理文件。

它包含这样一行:


ipconfig / all> c:\ MyAppDir \ IPdata.txt


我相信我可以用像Terry Kreft的ShellWait这样的东西来运行这些东西。我有什么理由要通过批处理文件运行程序

调用而不是直接启动命令

string?

解决方案

没有理由我能想到。


顺便说一句,你想要完成什么?可能你可以随意取回你想要的任何东西而不必诉诸这些扭曲。

看看Randy Birch在
http://vbnet.mvps.org/code/network/index.html


(ObWarning:Randy的网站针对VB程序员,而不是Access程序员。

表单上可用的控件之间存在显着差异在

VB与Access中的表单上可用的那些。因此,并非所有与Randy网站上的所有

GUI相关的代码都将移植到Access中。 />

-

Doug Steele,Microsoft Access MVP
http://I.Am/DougSteele

(请不要发电子邮件!)


" MLH" < CR ** @ NorthState.net>在消息中写道

news:9c ******************************** @ 4ax.com ...

我有一个名为GetConf.bat的批处理文件。
它包含这样一行:

ipconfig / all> c:\ MyAppDir \IPdata.txt

我相信我可以用像Terry Kreft的ShellWait这样的东西来运行。我是否应该通过批处理文件
调用而不是直接启动命令
字符串来运行程序?



< blockquote>谢谢,道格。关于Randy Birch网站,我想你可能已经指出使用INI文件的部分了吗?我找到了

但是没有。您正在谈论哪一部分?


BTW,我似乎遇到了ShellWait的问题...

调用ShellWait(" ipconfig /所有> c:\ IPdata.txt")DID NOT WORK !!!

ShellWait(" ipconfig / all> c:\ IPdata.txt")DID NOT WORK !!!

#AND#

调用ShellWait(" c:\Program Files \TPSCG \ GetConf.bat")工作!

ShellWait(c:\Program Files \TPSCG \ GetConf.bat)工作了!


我不明白。批处理文件GetConf.bat包含相同的CMD

字符串ipconfig / all> c:\ IPdata.txt但我已经过测试并且

文件 IPdata.txt"没有使用第一个

两种情况下的语法创建。

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxx


2005年12月13日星期二10 :14:19 -0500,Douglas J. Steele

< NOSPAM_djsteele@NOSPAM_canada.com>写道:

没有理由我能想到。

顺便说一下,你想要完成什么?可能你可以在不必诉诸这些扭曲的情况下找回你想要的任何东西。
看看Randy Birch的作品
http://vbnet.mvps.org/code/network/index.html

警告:Randy的网站是针对VB程序员而不是Access程序员。
VB中表单上的控件与Access中表单上可用的控件之间存在显着差异。 ,并非Randy网站上所有与GUI相关的代码都将移植到Access中




在某些情况下,我更喜欢使用批处理文件。


就像使用工作组启动数据库并使用start

命令切换。效益?您不需要知道网络上每个工作站上的msaccess.exe的完整路径

。 application.followhyperlink是我用来打开PDF文件的替代品。


" MLH" < CR ** @ NorthState.net>在消息中写道

news:9c ******************************** @ 4ax.com ...

我有一个名为GetConf.bat的批处理文件。
它包含这样一行:

ipconfig / all> c:\ MyAppDir \IPdata.txt

我相信我可以用像Terry Kreft的ShellWait这样的东西来运行。我是否应该通过批处理文件
调用而不是直接启动命令
字符串来运行程序?



I have a batch file named GetConf.bat.
It contains a line like this:

ipconfig /all >c:\MyAppDir\IPdata.txt

I believe I could run the line with something
like ShellWait by Terry Kreft. Any reason I
should run the procedure via a batch file
call as opposed to launching the command
string directly?

解决方案

No reason that I can think of.

What are you trying to accomplish, by the way? It may be that you can
retrieve whatever you want without having to resort to those contortions.
Take a look at what Randy Birch has at
http://vbnet.mvps.org/code/network/index.html

(ObWarning: Randy''s site is aimed at VB programmers, not Access programmers.
There are significant differences between the controls available on forms in
VB vs. those available on forms in Access. Consequently, not all of the
GUI-related code on Randy''s site will port into Access)

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"MLH" <CR**@NorthState.net> wrote in message
news:9c********************************@4ax.com...

I have a batch file named GetConf.bat.
It contains a line like this:

ipconfig /all >c:\MyAppDir\IPdata.txt

I believe I could run the line with something
like ShellWait by Terry Kreft. Any reason I
should run the procedure via a batch file
call as opposed to launching the command
string directly?



Thanks, Doug. Regarding the Randy Birch site, I thought you might
have been referring to the section on using INI files??? I found
nothing there though. Which part exactly were you talking about?

BTW, I seem to have run into a snag with ShellWait...
Call ShellWait("ipconfig /all >c:\IPdata.txt") DID NOT WORK!!!
ShellWait ("ipconfig /all >c:\IPdata.txt") DID NOT WORK!!!
#AND#
Call ShellWait("c:\Program Files\TPSCG\GetConf.bat") WORKED!
ShellWait ("c:\Program Files\TPSCG\GetConf.bat") WORKED!

I don''t understand. The batch file GetConf.bat contains the same CMD
string ipconfig /all >c:\IPdata.txt but I''ve tested and the
file "IPdata.txt" is not being created using the syntax in the first
two cases.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxx

On Tue, 13 Dec 2005 10:14:19 -0500, "Douglas J. Steele"
<NOSPAM_djsteele@NOSPAM_canada.com> wrote:

No reason that I can think of.

What are you trying to accomplish, by the way? It may be that you can
retrieve whatever you want without having to resort to those contortions.
Take a look at what Randy Birch has at
http://vbnet.mvps.org/code/network/index.html

(ObWarning: Randy''s site is aimed at VB programmers, not Access programmers.
There are significant differences between the controls available on forms in
VB vs. those available on forms in Access. Consequently, not all of the
GUI-related code on Randy''s site will port into Access)




In some conditions, I prefer to use a batch file.

Like starting a database with a workgroup and switches using the "start"
command. Benefit? You don''t need to know the full path of msaccess.exe on
each workstation on a network. application.followhyperlink is an
alternative I use to open PDF files.

"MLH" <CR**@NorthState.net> wrote in message
news:9c********************************@4ax.com...

I have a batch file named GetConf.bat.
It contains a line like this:

ipconfig /all >c:\MyAppDir\IPdata.txt

I believe I could run the line with something
like ShellWait by Terry Kreft. Any reason I
should run the procedure via a batch file
call as opposed to launching the command
string directly?



这篇关于有理由赞成直接在A97 VBA中调用批处理文件VS运行CMD吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆