父MSAccess进程的批处理Taskkill的问题 [英] Issues with Batch Taskkill of Parent MSAccess Process
问题描述
进程树:
我有一个MS Access版本控制宏,可以在打开时检查用户当前文件的版本,如果不是最新版本,则该宏会启动一个批处理文件,该文件应1)应删除其当前文件,然后2)从网络复制最新的前端版本,并将其粘贴到其本地系统上.
I have an MS Access version control macro that checks users current file version on open, and if not up-to-date, the macro launches a batch file that 1) should delete their current file, and then 2) copies the up-to-date front-end version from the network and pastes it on their local system.
我的问题:
除删除用户原始文件外,所有操作均有效.由于此文件是批处理文件的父进程,因此我没有找到杀死任务的方法,因此可以将其删除.
Everything works EXCEPT for the deletion of the users original file. Since this file is the parent process of the batch file I haven't found a way to Kill the task so it can be deleted.
当前代码:
TASKKILL /F /fi /IM MSACCESS.EXE /T
del "%originalFile%"
**我想也许我遇到了问题,因为该批次是Access流程中的一个子项目,因此我也尝试过运气不佳:
**I thought maybe I was having issues because the batch was a child of the Access process, so I've also tried with no luck:
TASKKILL /F /fi /IM MSACCESS.EXE
我总是会收到错误:
错误:语法无效.预期的"/fi"值.
ERROR: Invalid syntax. Value expected for '/fi'.
这是漫长的一天,所以我想我缺少一些简单的东西,并且会多看一些.任何帮助将不胜感激!
Its been a long day, so I assume I'm missing something simple and would love an extra set of eyes. Any help would be greatly appreciated!
推荐答案
我有一个类似的设置,但是没有TASKKILL.
I have a similar setup, but without TASKKILL.
启动更新批处理后,立即执行Application.Quit
Directly after launching my update batch, I do Application.Quit
' If need to update
Shell UPDATE_BATCH, vbNormalFocus
Application.Quit
在更新批处理中,我等待3秒钟,以便Access有足够的时间退出(并释放前端的锁).
And in the update batch, I wait for 3 seconds so that Access has enough time to exit (and release the lock on the frontend).
sleep.exe 3
REM ... copy new frontend ...
sleep.exe 1
REM ... start MSACCESS command line ...
如何睡觉"?参见此处: SLEEP.exe(2003资源工具包),了解不同的变体.
How to "sleep"? See here: SLEEP.exe (2003 Resource Kit) for different variants.
这篇关于父MSAccess进程的批处理Taskkill的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!