没有完整路径执行MSACCESS.EXE? [英] Executing MSACCESS.EXE without a full path?
问题描述
我有一个.BAT文件,我用它来执行各种MS Access应用程序,我在$ 2.0的时候写回来了。
它随着时间的推移而发展,但是它仍然包含许多可能的路径来获取
MSACCESS.EXE,尝试所有路径,获取它找到的第一个路径,如果没有路径就会死掉/>
找到。
在某些时候我似乎能够克隆这个.BAT文件和
实现它没路。关于MSACCESS是一个注册的
应用程序。
我现在想这样做,但发现只需在命令上键入MSACCESS.EXE
行不行......所以也许我记错了......
我的议程是防止这个.BAT文件多一点所以它并不依赖
在路径列表中。
建议?
------- -----------------------------------
对于具有重要性的人来说,这里'是该文件的副本。
实际上,它是三个文件:一个小的根。 .BAT文件,一个.TXT
文件,根目录复制到.BAT文件中,以及一个版本文件。文件
指定应用程序的最新版本。
Trets_Go1.bat:
---- ------------------------------------
@ECHO OFF
SET AppDirLAN = \\xxx\yyy \zzz \TRETS
SET AppDirLocal = C:\ Temp
COPY"%AppDirLan%\ Batat \ Trit_Go_2.txt" "%AppDirLocal%\ Trets_Go_2.bat"
CALL"%AppDirLocal%\ Trets_Go_2.bat"
----------- -----------------------------
Version.txt:
- ---------------------------------------
:* - -------------------------
:*此文件由2个Trets_Go Bat文件使用
:*决定执行哪个版本,如有必要,
:*复制到用户的C:驱动器。
:*
:*...刷新参数使我们能够
:*强制重新复制应用程序
:*给每个用户的C:驱动器。如果用户的
:*应用程序副本已损坏且我们这样做很有用
:*不想提升新版本。
:*
:*毋庸置疑,一旦有问题的用户调用了该应用,就应该将其设置回否
:*。 />
SET AppVersion = 019
SET AppRefresh = No
SET BatRefresh = No
-------- --------------------------------
Trets_Go2.txt:
----------------------------------------
@ECHO OFF
:*(请参阅文件末尾以获得解释性说明)
:* ------------ ------------------
:*将脚本名称/路径捕获到内存变量中
:*从技术上讲,这可能是看起来很多余,但是当我们
:*想要参考这些值时,它会使代码中的gobbeldygook少一点
:*
SET ScriptName =%~n0
SET ScriptPath =%~f0
:* ---------------- --------------
:*如果用户请求帮助,请显示帮助
:*
IF / i {%1} == {/ Help}(来电:帮助%2)& (GOTO:ExitNormal)
IF / i {%1} == {/?}(来电:帮助%2)& (GOTO:ExitNormal)
IF / i {%1} == {?}(来电:帮助%2)& (GOTO:ExitNormal)
:* ----------------------------- Begin Main程序----------------------------------------
:主要
ECHO。
ECHO。 --------------------------------
ECHO。设置常见变量......
ECHO。
CALL:setCommon
ECHO。
ECHO 。 --------------------------------
ECHO。设置TRETS特定的内存变量
ECHO。 (AppDirLocal和AppDirLan在Trets_Go_1中设置)
SET AppName = TretsApp
SET AppDescr = TRETS
SET IniPath =%AppDirLAN% \ Batat \TRETS.ini
SET SecPath =%AppDirLAN%\Bat \ SYSTEM.MDW
SET VerPath =%AppDirLan%\Bat \ Version .txt
TITLE%AppName%
ECHO。
ECHO。 --------------------------------
ECHO。验证/创建本地目录
ECHO。
如果不存在%AppDirLocal%MD%AppDirLocal%
ECHO 。
ECHO。 --------------------------------
ECHO。检查版本文件...
ECHO。
如果不存在%VerPath%GOTO
AbendVersionTxtMissing
: VerCopy
:* ----------------
:*将Versions.TXT文件复制到.BAT然后执行它设置内存
:*变量包含每个应用程序的最新版本号以及是否 - 或者不是
:*我们想强制刷新现有应用程序
:*
ECHO。
ECHO。 --------------------------------
ECHO。获取版本号...
ECHO。
COPY"%VerPath%"
%AppDirLocal%\ Trets_Version_Set.BAT
CALL%AppDirLocal%\ Trets_Version_Set.BAT
:BatCheck
:* --------------- -
:*检查AppDirLocal中现有的.BAT文件
:*如果它已经存在,则无意再将其复制下来...
:*
:*为了让事情更加无懈可击,我们可能想通过设置BatRefresh = Yes强制
:*副本。
:*
ECHO。
ECHO。 -----------------------
ECHO。检查你的电脑的.BAT文件的最新版本...
ECHO。
IF NOTIST'%AppDirLocal%\ Trets_Go_2。%BatVersion%.bat" GOTO BatCopy
IF%BatRefresh%== YES GOTO BatCopy
IF%BatRefresh%==是GOTO BatCopy
IF%BatRefresh%==是的GOTO BatCopy
GOTO EOF
:BatCopy
:* ----------------
:*将.BAT文件复制到用户的C:驱动器
:*
如果不存在%AppDirLAN%\ Bat \ Trets_Go_2.txt GOTO AbendBatMissing
DEL%AppDirLocal%\ Trets_Go。*。bat
ECHO。
ECHO。 -----------------------
ECHO。复制%AppDirLAN%\Bat \Trets_Go_2.txt下到
"%AppDirLocal%\ Trets_Go。%AppVersion%.bat" ....
ECHO。
COPY" %AppDirLAN%\Bat \Trets_Go_2.txt"
"%AppDirLocal%\ Trets_Go。%BatVersion%.bat"
:* - ---------------
:*检查各种各样的地方是否存在MS Access''
:* .EXE
:*
:*我们不验证整个目录。
:*只要MSACCESS.EXE在那里,我们
:*假设一切正常。
:*
:AccCheck
ECHO。
ECHO。 -----------------------
ECHO。正在寻找MS Access的副本...
ECHO。
set AccessPath =%AccessPath1%
IF EXIST %易达%QUOT; GOTO AppCheck
set AccessPath =%AccessPath2%
IF EXIST"%AccessPath%" GOTO AppCheck
set AccessPath =%AccessPath3%
IF EXIST"%AccessPath%" GOTO AppCheck
set AccessPath =%AccessPath4%
IF EXIST"%AccessPath%" GOTO AppCheck
GOTO AbendAccessMissing
:AppCheck
:* ----------------
:*检查C上的现有应用程序版本:
:*如果已经存在,则无需再次将其复制下来...
:*
:*为了让事情更加无懈可击,我们可能想通过设置AppRefresh = Yes来强制
:*副本。
:*
ECHO。
ECHO。 -----------------------
ECHO。在您的PC上检查应用程序的最新版本...
ECHO。
如果不存在%AppDirLocal%\%AppName%。%AppVersion%.mdb GOTO AppCopy
IF%AppRefresh%== YES GOTO AppCopy
IF%AppRefresh%==是GOTO AppCopy
IF%AppRefresh%==是的GOTO AppCopy
GOTO AppStart
:AppCopy
:* ----------------
:*将应用程序复制到用户的C:驱动器
:*
如果不存在%AppDirLAN%\%AppName% 。%AppVersion%。mdb GOTO AbendAppMissing
DEL%AppDirLocal%\%AppName%。*。mdb
ECHO。
ECHO。 -----------------------
ECHO。将新版本的应用程序复制到您的PC ....
ECHO。
XCOPY"%AppDirLAN%\%AppName%。%AppVersion%。mdb" %AppDirLocal%\ / K
:AppStart
ECHO。
ECHO。 -----------------------
ECHO。开始MS Access ...
ECHO。
START / B / HIGH / MAXFIMMA Startup "%AccessPath%"
%AppDirLocal%\%AppName%。%AppVersion%。mdb / ini"%IniPath%" / wrkgrp"%SecPath%"
/ excl
SET RET = 0
GOTO:EOF
:* -----------------------------结束主要程序------------ ----------------------------
:setCommon
:* ----------------
:*指定最多四个替代品
:*查找独立MS Access,排名
:*按搜索顺序排序:首先找到的是
:*一个用过的。
:*
:*注意:当我们执行START时,会添加任何所需的报价。命令
SET AccessPath1 = C:\Program Files \ Microsoft Office 2000 \ Office \ MSACCESS.EXE
SET AccessPath2 = c:\程序文件\ microsoft office\office \ msaccess.exe
SET AccessPath3 = C:\ Microsoft Office \ Office \ MSACCESS.EXE
SET AccessPath4 = E:\Program Files \Office.2K \ Office \ MSACCESS.EXE
GOTO:EOF
:帮助
:*这个例程是多余的,因为我们在命令行上没有需要提供的parms
:*。我们留下它以防万一我们有一天加入parms。
ECHO。
ECHO。
ECHO。 ----------------------------------------
ECHO。
IF NOT"%BadParam%" =="" COLOR E0& ECHO。嗯,哦!参数错误或缺失。
ECHO。
ECHO。这个命令的语法应该是:
ECHO。
ECHO。 Trets_Go_2
ECHO。
ECHO。 ----------------------------------------
ECHO。
PAUSE
GOTO:EOF
:AbendAccessMissing
ECHO OFF
COLOR E0
ECHO .-----------无法运行%AppDescr%
ECHO。
ECHO。无法在以下任何一条路径中找到MS Access:
ECHO。
ECHO。 %AccessPath1%
ECHO。 %AccessPath2%
ECHO。 %AccessPath3%
ECHO。 %AccessPath4%
ECHO。
ECHO。请通知主管或局域网经理。
ECHO。
ECHO。 %ScriptPath \%ScriptName%
ECHO .--------------------------------- -----------
PAUSE
GOTO:ExitNormal
:AbendAppMissing
颜色E0
ECHO .-----------无法运行%AppDescr%
ECHO。
ECHO 。 %AppDirLAN%\%AppName%。%AppVersion%。mdb not found。
ECHO。
ECHO。请通知主管或局域网经理。
ECHO。
ECHO。 %ScriptPath \%ScriptName%
ECHO .--------------------------------- -----------
PAUSE
GOTO:ExitNormal
:AbendBatMissing
COLOR E0
ECHO .-----------无法运行%AppDescr%
ECHO。
ECHO。找不到%AppDirLAN%\ Bath \\ _Trets_Go_2.txt。
ECHO。
ECHO。请通知主管或局域网经理。
ECHO。
ECHO。 %ScriptPath \%ScriptName%
ECHO .--------------------------------- -----------
PAUSE
GOTO:ExitNormal
:AbendVersionTxtMissing
ECHO关闭
颜色E0
ECHO .-----------无法运行%AppDescr%
ECHO。
ECHO。未找到%VerPath%。
ECHO。
ECHO。请通知主管或局域网经理。
ECHO。
ECHO。
ECHO。 %ScriptPath \%ScriptName%
ECHO .--------------------------------- -----------
PAUSE
GOTO:ExitNormal
:ExitNormal
GOTO :EOF
:* ================================== ================ ===========================
:*(这些评论是如此冗长,以至于他们实际上放慢了执行速度
:*当它们在文件的开头处时 - 所以我们将它们移到这里)
:*
:*用途:下载多个应用程序之一的最新版本
:*并在MS Access下启动它。
:* ACCEPTS :(没有)
:*需要: - 一个名为''Versions.txt''的文本文件。请参阅下面的''VerPath''
:*参数。最后的备注中附有一个示例文件
:*此.BAT文件。
:*
:*注意:0)备注当通过LAN运行.BAT文件时执行速度过慢。
:*因此我们在局域网上有一个小根.BAT文件(Trets_Go_1.bat)
:*将此.TXT文件复制到C:\ TEMP并将其重命名为.BAT。
:*这会加快执行a * LOT *。
:*
:* 1)这完全取决于您的应用程序的三级命名约定
:*以应用程序名称开头,包括三位数版本号,
:*并以.MDB结尾。
:*例如TimeTrackerApp.016.mdb将是Time Tracker应用程序的0.16版本。
:*
:* 2)这是用于从命令行的快捷方式调用那个
:*读取的内容如下:D:\ TimeTracker \ Batat \ AccessApp.bat TimeTracker
:*
:* 3 )在此过程中设置了相当多的内存变量。
:*如果您创建NT 3.51快捷方式,请确保它的环境
:*最大值为4096或此程序可能会耗尽环境
:*空格和死亡。
:*
:* 4)内存变量您需要在定制时仔细阅读和设置
:*针对给定局域网情况的此程序为:
:*
:*
:* IniPath - 应用程序使用的.INI文件的完整DOS路径或UNC
:*这是o我们安装了Access命令行。
:*注意:每个应用程序应该尝试使用相同的.INI文件,但是我们这样做
:*这样在有人想要他们自己的....
:* SecPath - 我们用于安全的.MDA文件的完整DOS路径或UNC
:* VerPath - The完整的DOS路径或UNC到包含
的小.TXT文件:*每个应用程序的最新版本号。
:* AccessPath1 - 一个完整的DOS路径或UNC到某个地方我们在哪里可以找到
:*完整安装MS Access 8.0
:*可以有不同的Access安装,只要每个都是
:*代表这里
:*
:*向下滚动到过程:setCommon;看看这些变量。
:*
:* 6)需要为每个应用程序设置的内存变量是:
:*
:* AppName - 出现在.mdb文件名中的应用程序名称。
:* SB与该应用程序的参数完全相同。
:* AppDescr - 用户友好的错误消息简短描述
:* AppVersion - 应用程序的版本。从.TXT文件设置。
:* AppRefresh - 我们是否要强制提供应用程序的新副本
:*给用户'即使已经存在一个C:驱动器。
:* AppDirLAN - 指向目录的DOS路径或UNC
:*
:*向下滚动到给定的应用程序":set [AppName]"程序看看
:*这些变量。
:*
:* 7)最后但并非最不重要的是版本文件 ; - 当前命名为Versions.txt。
:*它为每个应用程序加载两个变量:
:* .... Version(例如TimeTrackerVersion, FimmaVersion,它告诉我们运行什么版本的应用程序
:* ....刷新(例如TimeTracker,FimmaRefresh),它告诉是否 - 或者
:*我们想要下载应用程序,即使它已经在用户的PC上了
:*
:* ==== ============================================== ==== =======================
--------------- -------------------------
-
PeteCresswell
I''ve got a .BAT file that I use for executing various MS Access apps that I
wrote way back in the days of 2.0.
It''s evolved over time, but it still contains a number of possible paths to
MSACCESS.EXE, tries them all, takes the first one it finds, and dies if none is
found.
Seems to me like at some time or another I was able to clone this .BAT file and
implement it with no path. Something about MSACCESS being a registered
application.
I''d like to do that now, but find that just typing MSACCESS.EXE on the command
line doesn''t work....so maybe I rememeber wrong....
My agenda is to bulletproof this .BAT file a little more so it isn''t dependent
on a list of paths.
Suggestions?
------------------------------------------
For the maschoistically-inclined, here''s a copy of the file.
Actually, it''s three files: A small "root" .BAT file, a .TXT
file that the root copies into a .BAT file, and a "Version" file
that specifiesd the latest-and-greatest version of the app.
Trets_Go1.bat:
----------------------------------------
@ECHO OFF
SET AppDirLAN=\\xxx\yyy\zzz\TRETS
SET AppDirLocal=C:\Temp
COPY "%AppDirLan%\Bat\Trets_Go_2.txt" "%AppDirLocal%\Trets_Go_2.bat"
CALL "%AppDirLocal%\Trets_Go_2.bat"
----------------------------------------
Version.txt:
----------------------------------------
:* --------------------------
:* This file is used by the 2 Trets_Go Bat files
:* to decide which version to execute and, if necessary,
:* copy down to the user''s C: drive.
:*
:* The "...Refresh" parameters enable us
:* to force a re-copy of an application down
:* to each user''s C: drive. Useful if a user''s
:* copy of the app becomes corrupted and we do
:* not want to elevate a new version.
:*
:* Needless to say, it should be set back to "NO"
:* once the user in question has invoked the app.
SET AppVersion=019
SET AppRefresh=No
SET BatRefresh=No
----------------------------------------
Trets_Go2.txt:
----------------------------------------
@ECHO OFF
:* (Please refer to end of file for explainatory remarks)
:* ------------------------------
:* Capture script name/path into memory variables
:* Technically, this may seem redundant, but it makes
:* for a little lesss gobbeldygook in the code when we
:* want to refer to these values
SET ScriptName=%~n0
SET ScriptPath=%~f0
:* ------------------------------
:* If user asked for help, display help
:*
IF /i {%1}=={/Help} (call :Help %2) & (GOTO :ExitNormal)
IF /i {%1}=={/?} (call :Help %2) & (GOTO :ExitNormal)
IF /i {%1}=={?} (call :Help %2) & (GOTO :ExitNormal)
:* -----------------------------Begin Main Procedure ----------------------------------------
:Main
ECHO .
ECHO . --------------------------------
ECHO . Setting common variables...
ECHO .
CALL :setCommon
ECHO .
ECHO . --------------------------------
ECHO . Setting TRETS-specific memory variables
ECHO . (AppDirLocal and AppDirLan set in Trets_Go_1)
SET AppName=TretsApp
SET AppDescr=TRETS
SET IniPath=%AppDirLAN%\Bat\TRETS.ini
SET SecPath=%AppDirLAN%\Bat\SYSTEM.MDW
SET VerPath=%AppDirLan%\Bat\Versions.txt
TITLE %AppName%
ECHO .
ECHO . --------------------------------
ECHO . Verifying/creating local directory
ECHO .
IF NOT EXIST %AppDirLocal% MD %AppDirLocal%
ECHO .
ECHO . --------------------------------
ECHO . Checking for version file...
ECHO .
IF NOT EXIST %VerPath% GOTO
AbendVersionTxtMissing
:VerCopy
:* ----------------
:* Copy Versions.TXT file to .BAT and then execute it to set memory
:* variables containing latest version number for each app and whether-or-not
:* we want to force a refresh of existing app
:*
ECHO .
ECHO . --------------------------------
ECHO . Getting version numbers...
ECHO .
COPY "%VerPath%"
%AppDirLocal%\Trets_Version_Set.BAT
CALL %AppDirLocal%\Trets_Version_Set.BAT
:BatCheck
:* ----------------
:* Check for existing .BAT file in AppDirLocal
:* No sense copying it down again if it already exists...
:*
:* To make things more bulltproof, we may want to force
:* a copy anyhow by setting "BatRefresh=Yes".
:*
ECHO .
ECHO . -----------------------
ECHO . Checking latest version of .BAT file on your PC...
ECHO .
IF NOT EXIST "%AppDirLocal%\Trets_Go_2.%BatVersion%.bat" GOTO BatCopy
IF %BatRefresh%==YES GOTO BatCopy
IF %BatRefresh%==Yes GOTO BatCopy
IF %BatRefresh%==yes GOTO BatCopy
GOTO EOF
:BatCopy
:* ----------------
:* Copy the .BAT file down to user''s C: drive
:*
IF NOT EXIST %AppDirLAN%\Bat\Trets_Go_2.txt GOTO AbendBatMissing
DEL %AppDirLocal%\Trets_Go.*.bat
ECHO .
ECHO . -----------------------
ECHO . Copying "%AppDirLAN%\Bat\Trets_Go_2.txt" down to
"%AppDirLocal%\Trets_Go.%AppVersion%.bat"....
ECHO .
COPY "%AppDirLAN%\Bat\Trets_Go_2.txt"
"%AppDirLocal%\Trets_Go.%BatVersion%.bat"
:* ----------------
:* Check for existance of MS Access''
:* .EXE in various and sundry locations
:*
:* We don''t validate the entire directory.
:* As long as MSACCESS.EXE is there, we
:* assume everything else is OK.
:*
:AccCheck
ECHO .
ECHO . -----------------------
ECHO . Looking for a copy of MS Access...
ECHO .
set AccessPath=%AccessPath1%
IF EXIST "%AccessPath%" GOTO AppCheck
set AccessPath=%AccessPath2%
IF EXIST "%AccessPath%" GOTO AppCheck
set AccessPath=%AccessPath3%
IF EXIST "%AccessPath%" GOTO AppCheck
set AccessPath=%AccessPath4%
IF EXIST "%AccessPath%" GOTO AppCheck
GOTO AbendAccessMissing
:AppCheck
:* ----------------
:* Check for existing app version on C:
:* No sense copying it down again if it already exists...
:*
:* To make things more bulltproof, we may want to force
:* a copy anyhow by setting "AppRefresh=Yes".
:*
ECHO .
ECHO . -----------------------
ECHO . Checking latest version of application on your PC...
ECHO .
IF NOT EXIST %AppDirLocal%\%AppName%.%AppVersion%.mdb GOTO AppCopy
IF %AppRefresh%==YES GOTO AppCopy
IF %AppRefresh%==Yes GOTO AppCopy
IF %AppRefresh%==yes GOTO AppCopy
GOTO AppStart
:AppCopy
:* ----------------
:* Copy the app down to user''s C: drive
:*
IF NOT EXIST %AppDirLAN%\%AppName%.%AppVersion%.mdb GOTO AbendAppMissing
DEL %AppDirLocal%\%AppName%.*.mdb
ECHO .
ECHO . -----------------------
ECHO . Copying new version of application down to your PC....
ECHO .
XCOPY "%AppDirLAN%\%AppName%.%AppVersion%.mdb" %AppDirLocal%\ /K
:AppStart
ECHO .
ECHO . -----------------------
ECHO . Starting MS Access...
ECHO .
START /B /HIGH /MAX "FIMMA Startup" "%AccessPath%"
%AppDirLocal%\%AppName%.%AppVersion%.mdb /ini "%IniPath%" /wrkgrp "%SecPath%"
/Excl
SET RET=0
GOTO :EOF
:* -----------------------------End Main Procedure ----------------------------------------
:setCommon
:* ----------------
:* Specify up to four alternatives for
:* finding standalone MS Access, ranked
:* by search order: first one found is the
:* one that''s used.
:*
:* NB: Any required quotes get added when we do the "START" command
SET AccessPath1=C:\Program Files\Microsoft Office 2000\Office\MSACCESS.EXE
SET AccessPath2=c:\program files\microsoft office\office\msaccess.exe
SET AccessPath3=C:\Microsoft Office\Office\MSACCESS.EXE
SET AccessPath4=E:\Program Files\Office.2K\Office\MSACCESS.EXE
GOTO :EOF
:Help
:* This routine is redundant since we have no parms that need to be supplied
:* on the command line. We left it in in case we add parms some day.
ECHO .
ECHO .
ECHO . ----------------------------------------
ECHO .
IF NOT "%BadParam%"=="" COLOR E0 & ECHO . Uh-Oh! Bad or missing parameter.
ECHO .
ECHO . The syntax of this command should be:
ECHO .
ECHO . "Trets_Go_2"
ECHO .
ECHO . ----------------------------------------
ECHO .
PAUSE
GOTO :EOF
:AbendAccessMissing
ECHO OFF
COLOR E0
ECHO .----------- Cannot Run %AppDescr%
ECHO .
ECHO . Could not find MS Access in any of these paths:
ECHO .
ECHO . %AccessPath1%
ECHO . %AccessPath2%
ECHO . %AccessPath3%
ECHO . %AccessPath4%
ECHO .
ECHO . Please notify supervisor or LAN manager.
ECHO .
ECHO . %ScriptPath\%ScriptName%
ECHO .--------------------------------------------
PAUSE
GOTO :ExitNormal
:AbendAppMissing
COLOR E0
ECHO .----------- Cannot Run %AppDescr%
ECHO .
ECHO . %AppDirLAN%\%AppName%.%AppVersion%.mdb not found.
ECHO .
ECHO . Please notify supervisor or LAN manager.
ECHO .
ECHO . %ScriptPath\%ScriptName%
ECHO .--------------------------------------------
PAUSE
GOTO :ExitNormal
:AbendBatMissing
COLOR E0
ECHO .----------- Cannot Run %AppDescr%
ECHO .
ECHO . %AppDirLAN%\Bat\Trets_Go_2.txt not found.
ECHO .
ECHO . Please notify supervisor or LAN manager.
ECHO .
ECHO . %ScriptPath\%ScriptName%
ECHO .--------------------------------------------
PAUSE
GOTO :ExitNormal
:AbendVersionTxtMissing
ECHO OFF
COLOR E0
ECHO .----------- Cannot Run %AppDescr%
ECHO .
ECHO . %VerPath% not found.
ECHO .
ECHO . Please notify supervisor or LAN manager.
ECHO .
ECHO .
ECHO . %ScriptPath\%ScriptName%
ECHO .--------------------------------------------
PAUSE
GOTO :ExitNormal
:ExitNormal
GOTO :EOF
:* ================================================== ===========================
:* (these remarks are so lengthy that they were actually slowing down the execution
:* when they were up in the beginning of the file - so we moved them here)
:*
:* PURPOSE: To download the latest version of one of several applications
:* and start it up under MS Access.
:* ACCEPTS: (nothing)
:* NEEDS: - A text file named ''Versions.txt''. Refer to the ''VerPath''
:* parameter below. A sample file is appended in remarks at the end
:* of this .BAT file.
:*
:* NOTES: 0) Remarks slow execution too much when a .BAT file is run over the LAN.
:* Therefore we have a little root .BAT file on the lan ("Trets_Go_1.bat")
:* that copies this .TXT file down to C:\TEMP and renames it to .BAT.
:* This speeds up execution a *LOT*.
:*
:* 1) This is all dependent upon a three-level naming convention for your app
:* that begins with the app name, includes a three-digit version number,
:* and ends with ".MDB".
:* e.g. TimeTrackerApp.016.mdb would be version 0.16 of the Time Tracker application.
:*
:* 2) This is intended to be called from a shortcut with a command line that
:* reads something like: D:\TimeTracker\Bat\AccessApp.bat TimeTracker
:*
:* 3) Quite a few memory variables are set within this procedure.
:* If you create an NT 3.51 shortcut, make sure it''s "Environment"
:* is maxed at 4096 or this procedure may run out of environment
:* space and die.
:*
:* 4) Memory variables that you need to peruse and set when customizing
:* this procedure for a given LAN situation are:
:*
:*
:* IniPath - The full DOS path or UNC to the .INI file used by the application
:* This is the one we put on the Access command line.
:* NB: Each app should try to use the same .INI file, but we do it
:* this way in case somebody wants their very own....
:* SecPath - The full DOS path or UNC to the .MDA file we use for security
:* VerPath - The full DOS path or UNC to the little .TXT file that contains
:* latest version number of each app.
:* AccessPath1 - A full DOS path or UNC to someplace where we can find
:* a complete install of MS Access 8.0
:* AccessPath2, 3, 4 - Ditto AccessPath1. This means that different users
:* can have different installs of Access as long as each is
:* represented here
:*
:* Scroll down to procedure ":setCommon" to see these variables.
:*
:* 6) Memory variables that need to be set for each application are:
:*
:* AppName - The name of the application as it appears in the .mdb file name.
:* SB exactly the same as the parameter for that app.
:* AppDescr - User friendly short description for error messages
:* AppVersion - The version of the application. Set from the .TXT file.
:* AppRefresh - Whether-or-not we want to force-feed a new copy of the app
:* to the user''s C: drive even though one is already there.
:* AppDirLAN - The DOS path or UNC that points to the directory where
:*
:* Scroll down to a given applications ":set[AppName]" procedure to see
:* these variables.
:*
:* 7) Last, but not least, is the "Version File" - currently named "Versions.txt".
:* It loads two variables for each application:
:* ....Version (e.g. "TimeTrackerVersion", "FimmaVersion") which tells what version of the app to run
:* ....Refresh (e.g. "TimeTracker", "FimmaRefresh") which tells whether-or-not
:* we want to download the app even though it is already on the user''s PC
:*
:* ================================================== ===========================
----------------------------------------
--
PeteCresswell
推荐答案
RE /
建议?
搞定了!
在这种情况下,神奇的词是开始。
例如
C:\\ \\ START MSACCESS
-
PeteCresswell
Got it!
The magic word, in this case, is "START".
e.g.
C:\ START MSACCESS
--
PeteCresswell
x @ yz((Pete Cresswell))写在
< g3 ** ******************************@4ax.com>:
x@y.z ((Pete Cresswell)) wrote in
<g3********************************@4ax.com>:
RE /
建议?
知道了!
在这种情况下,神奇的词是START。
例如
C:\ START MSACCESS
Got it!
The magic word, in this case, is "START".
e.g.
C:\ START MSACCESS
这并不适用于所有Windows安装。
-
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
2003年11月21日星期五00 :格林威治标准时间52:17,(Pete Cresswell) < x@y.z>写道:
其他建议:进入21世纪并使用shell脚本
文件。您可以在VBScript中编写它,使用Windows
脚本宿主(wscript.exe)执行它。现在您可以使用CreateObject创建一个
MsAccess对象。
-Tom。
On Fri, 21 Nov 2003 00:52:17 GMT, "(Pete Cresswell)" <x@y.z> wrote:
Other suggestion: step into the 21st century and use a shell script
file. You can write it in VBScript, execute it using the Windows
Script Host (wscript.exe). Now you can use CreateObject to create an
MsAccess object.
-Tom.
我有一个.BAT文件,我用它来执行我在2.0时代写过的各种MS Access应用程序。
它随着时间的推移而发展,但是它仍然包含许多可能的路径来访问MSACCESS.EXE,尝试所有路径,获取它找到的第一个路径,如果没有找到它就会死掉。
对我来说喜欢在某个时间或另一个时间我能够克隆这个.BAT文件并实现它没有路径。关于MSACCESS是一个注册的应用程序的东西。
我现在想这样做,但发现只需在命令
行上输入MSACCESS.EXE就不行了工作....所以也许我记得错了....
我的议程是为了防止这个.BAT文件多一点,所以它不依赖于路径列表。
建议?
I''ve got a .BAT file that I use for executing various MS Access apps that I
wrote way back in the days of 2.0.
It''s evolved over time, but it still contains a number of possible paths to
MSACCESS.EXE, tries them all, takes the first one it finds, and dies if none is
found.
Seems to me like at some time or another I was able to clone this .BAT file and
implement it with no path. Something about MSACCESS being a registered
application.
I''d like to do that now, but find that just typing MSACCESS.EXE on the command
line doesn''t work....so maybe I rememeber wrong....
My agenda is to bulletproof this .BAT file a little more so it isn''t dependent
on a list of paths.
Suggestions?
< clip>
<clip>
这篇关于没有完整路径执行MSACCESS.EXE?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!