【问题标题】:Dynamic User in .bat file.bat 文件中的动态用户
【发布时间】:2020-11-12 02:45:12
【问题描述】:

这是我第一次尝试使用 .bat 文件。我正在尝试制作一个将我的 Access 数据库前端保持在最新版本的用户(仅 ~7)。

我正在使用:

md C:\Users\tmyers\Desktop
del C:\Users\tmyers\Desktop\Quotations.accdr
copy "\Users\counter1152\desktop\PM DESKTOP FILES\Lighting Project Management Application\Quotations.accdr" C:\Users\tmyers\Desktop
C:\Users\tmyers\Desktop\Quotations.accdr

我删除了部分复制字符串,因为它是我们服务器的路径(以防万一)。我需要用户根据执行文件的人以某种方式动态。我可以为每个人制作一个特殊的 .bat 文件,因为我没有很多用户,但这似乎很草率。

作为第二个问题,我怎样才能让 cmd 提示窗口在执行时不显示?那只是我的个人喜好。我确实找到了https://superuser.com/questions/140047/how-to-run-a-batch-file-without-launching-a-command-window 以供参考,但我不是 100% 确定如何执行 wscript。

【问题讨论】:

标签: ms-access batch-file


【解决方案1】:

尝试:

md "%userprofile%\Desktop"
del "%userprofile%\Desktop\Quotations.accdr"
copy "\Users\counter1152\desktop\PM DESKTOP FILES\Lighting Project Management Application\Quotations.accdr" "%userprofile%\Desktop"
"%userprofile%\Desktop\Quotations.accdr"

要自动隐藏 cmd.exe 窗口,您可以使用 windowmode.batgetCMDPid.bat

call getcmdbit.bat
call windowmode.bat -pid %errorlevel% -mode hidden

【讨论】:

  • 成功了!谢谢你。你有没有机会对我的问题的第二部分有所了解?然而,这是我追求的主要目标。
猜你喜欢
  • 2023-04-03
  • 1970-01-01
  • 1970-01-01
  • 2021-08-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多