文件夹中新文件的打印请求
我遇到以下问题:
我需要做一些检查以查看文件是否已添加到特定文件夹,如果是,则需要打印该文件。我听说 Windows 可能内置了类似的东西?
*Program constantly checks whether a file has been added*
File has been added
File gets printed immediately
我已经找到了解决方案,但你需要付费。
更新
"Code supplied by Vik"
:start
set SECONDS=60
SET FILENAME=*.jpg
IF EXIST %FILENAME% MSPAINT /p %FILENAME%
choice /C a /T %SECONDS% /D a
DEL /Q %FILENAME%
goto :start
"Edits: COPY *.JPG file to a different folder (E.G. ImageHistory)"
"Edits: DELETE local *.JPG file leaving the monitor folder empty"
欢迎任何提示或帮助!
I've got the following problem:
I need to make something that checks to see whether a file has been added to a specific folder, ifso this file needs to be printed. I heard Windows maybe has something similar built in?
*Program constantly checks whether a file has been added*
File has been added
File gets printed immediately
I have found solutions, but you need to pay for them.
UPDATE
"Code supplied by Vik"
:start
set SECONDS=60
SET FILENAME=*.jpg
IF EXIST %FILENAME% MSPAINT /p %FILENAME%
choice /C a /T %SECONDS% /D a
DEL /Q %FILENAME%
goto :start
"Edits: COPY *.JPG file to a different folder (E.G. ImageHistory)"
"Edits: DELETE local *.JPG file leaving the monitor folder empty"
Any tips or help are welcome!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
该批处理文件将每 60 秒检查一次 printme.jpg 文件是否存在。如果存在,它将使用内置的 MSPAINT 程序来打印它。请随意配置 SECONDS 和 FILENAME 以适合您的环境。
您可能想要制作的其他模组:
PING 1.1.1.1 -n 1 -w 60000 >NUL
DEL /Q % FILENAME%
编辑(下):添加多文件、移动和删除功能
This batch file will check if the file printme.jpg exists every 60 seconds. If it exists, it will use the built-in MSPAINT program to print it. Feel free to configure SECONDS and FILENAME to suit your environment.
Additional mods you may want to make:
PING 1.1.1.1 -n 1 -w 60000 >NUL
DEL /Q %FILENAME%
EDIT (Below): Added multi-file, move and delete capability
在后台运行 VB.Net 并使用 FileSystemWatcher获取该文件夹中每个更改的事件。收到事件后,检查文件/操作并使用可以打印文件的任何应用程序打印文件。批处理文件在这里可能不起作用。
Run a VB.Net in Background and use a FileSystemWatcher to get events for each change in that folder. Upon receiving an event, check the file / action and print the file using whatever App that can print them. A Batch file will likely not work here.