c#的一个控制台程序能不能生成三个不同功能的exe程序呢? 控制台exec#遍历图片 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 那你就把这个程序复制3份(3个Console工程),然后各取所需呗。难道说你不会删代码? 一个project只应有一个主输出(exe或者dll或其他),一个solution可以包含多个project。你只需要建立3个project,把输出文件夹调整到同一目录即可。 void Main(string[] args){ switch args[0] { case "-a": 功能1的代码; break; case "-b": 功能2的代码; break; case "-c": 功能3的代码; break; }} +1用“\DirFileTreeInfo.exe -d ” “\CopyFile.exe ” “\PickFile.exe -d ”进行条件判断 +1用“\DirFileTreeInfo.exe -d ” “\CopyFile.exe ” “\PickFile.exe -d ”进行条件判断用“\DirFileTreeInfo.exe -d ” “\CopyFile.exe ” “\PickFile.exe -d ”进行条件判断就是把"a","b","c",换成前面的那些名称吗??还有就是那个我怎么把输入的两个路径(比如在移动中:一个是要初始位置文件夹的路径,另外一个是目的文件夹的路径)在对应的代码中使用呢? 本人是新手,如问题描述得不具体详细,请多多包涵。谢谢各位大神为我解答啦。 因为是三个应用程序,所以你就需要写三个控制台程序分别实现,下面是DirFileTreeInfo.exe的代码,用的时候直接调用cmd就可以了“..\..\DirFileTreeInfo.exe -d D:\games -o D:\gamesinfo.txt”,其中..\..\DirFileTreeInfo.exe要用绝对路径;对于CopyFile.exe和PickFile.exe,你自己参考着写写吧。另外,就http://bbs.csdn.net/topics/390844819这个帖子而言,是因为你在使用args时没有传递参数造成的,所以在用cmd时,要正确传递参数static void Main(string[] args) { if (args.Count() == 4) { string param1 = args[0]; string path1 = args[1]; string param2 = args[2]; string path2 = args[3]; if (param1 == "-d" && param2 == "-o") { string[] dics = Directory.GetDirectories(path1); string[] files = Directory.GetFiles(path1); using (StreamWriter sw = new StreamWriter(path2)) { foreach (string d in dics) { sw.WriteLine(d); } foreach (string f in files) { sw.WriteLine(f); } sw.Close(); } } } } 请问,时间戳 求助C#调用C++的DLL问题 关于址传递 问题 很简单 C# Winform 如何在代码中添加Picturebox控件 应该怎么样发布网站?? 窗体切换请指教 问一个DLL安装方面的问题,谢谢 怎样释放静态(static)的数据成员,使它不再占用内存? 如何用oledb的方法将sql server中的数据插入excel啊? 关闭c#窗体的问题 C# Winform word打印 关于使用MEF动态装载后,想实例化自己想要的实例问题
你只需要建立3个project,把输出文件夹调整到同一目录即可。
{
switch args[0]
{
case "-a":
功能1的代码;
break;
case "-b":
功能2的代码;
break;
case "-c":
功能3的代码;
break;
}
}
用“\DirFileTreeInfo.exe -d ” “\CopyFile.exe ” “\PickFile.exe -d ”进行条件判断就是把"a","b","c",换成前面的那些名称吗??还有就是那个我怎么把输入的两个路径(比如在移动中:一个是要初始位置文件夹的路径,另外一个是目的文件夹的路径)在对应的代码中使用呢?
本人是新手,如问题描述得不具体详细,请多多包涵。谢谢各位大神为我解答啦。
另外,就http://bbs.csdn.net/topics/390844819这个帖子而言,是因为你在使用args时没有传递参数造成的,所以在用cmd时,要正确传递参数static void Main(string[] args)
{
if (args.Count() == 4)
{
string param1 = args[0];
string path1 = args[1];
string param2 = args[2];
string path2 = args[3];
if (param1 == "-d" && param2 == "-o")
{
string[] dics = Directory.GetDirectories(path1);
string[] files = Directory.GetFiles(path1);
using (StreamWriter sw = new StreamWriter(path2))
{
foreach (string d in dics)
{
sw.WriteLine(d);
}
foreach (string f in files)
{
sw.WriteLine(f);
}
sw.Close();
}
}
}
}