一次运行两个程序. [英] Run two programs at once.

查看:94
本文介绍了一次运行两个程序.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前设计:
您单击快捷方式,然后会弹出一个窗口,询问您源目录和目标目录.您提供此信息,然后将一个目录中的文件复制到另一目录.当我计划将其作为自动化任务运行时,总是会弹出窗口询问源目录和目标目录.

我想要的内容:
当您计划程序作为自动化任务运行,它不会要求用户提供源目录和目标目录.如果用户需要更改源和目​​标,则可以双击快捷方式,然后再次弹出界面,要求他们提供源和目标信息.

问题:

推荐答案

您好,
我认为您的问题更多是与设计有关,而不是与任何特定语言有关.如果我没看错,则您当前的设计是交互式的,并提示用户输入源目录和目标目录.

在无人值守的情况下运行时,您的目录数据源是什么?一种解决方案是提供命令行界面.例如,

FileCopier srcdir targetdir

然后您的代码可以执行以下操作:

1)如果有任何命令行参数,则假定这是无人值守的运行.
2)验证参数以确保目录存在.
3)在src和dest目录上执行操作.
4)编写一个日志文件,以便您查看不存在目录时发生的情况.

希望有帮助,....艾伦.
Hi,
I think your problem is more about design rather than any particular language. If I read you correctly your current design is interactive and prompts the user for source and target directories.

When running unattended what is your source of directory data? One solution would be to provide a command line interface. e.g.

FileCopier srcdir targetdir

Your code could then do the following:

1) If there are any command line arguments assume that this is an unattended run.
2) Validate the arguments to ensure that the directories exist.
3) Perform your actions on the src and dest directories.
4) Write a log file so that you can check what happened when you weren''t there.

Hope that helps, ....Alan.


检查System.Environment.UserInteractive


这篇关于一次运行两个程序.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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