-1
我在使用gnu“find”在我的c#app中移植时出现问题。让我更好地解释:如何在c#中使用gnu命令#
在我的winform应用程序中我有一个按钮。当我按下这个按钮我需要启动这个命令(输入cmd.exe这个效果很好):
gfind training_set\positives\*.jpg -exec identify -format "%i 1 0 0 %w %h \n" {} ; > training_set\positives.dat
我用这个:
string find = "gfind.exe ";
string command = textBox4.Text + "\\positives\\*.jpg -exec identify -format \" %i 1 0 0 %w %h \n\" {} /; > " + textBox4.Text + "\\positives.dat";
System.Diagnostics.Process.Start("CMD.exe", "/C "+find + command);
但外壳打开,并告诉我,我的天堂” t通过任何参数-exec
任何想法?
编辑: 这项工作: 串路径= textBox4.Text + @ “\阳性\”; System.Diagnostics.Process.Start(“CMD.exe”,“/ C cd”+ textBox4.Text +“& & gfind positives \ *。png -exec identify -format;>”+ textBox4.Text +“\ positives .DAT“);
但 -format需要这样的说法: '我%1 0 0%重量%H \ n'{}这种方式不工作 ...
EDIT2: OK差不多了..
System.Diagnostics.Process.Start("CMD.exe", "/C cd " + textBox4.Text + " && gfind positives\\*.png -exec identify -format \"%i 1 0 0 %w %h\" {} ; > " + textBox4.Text + "\\positives.dat");
确定这工作,但打印在同一行中的每个条目:
positives\3LiIIH8.png 1 0 0 28 20positives\5NoLpfy.png 1 0 0 28 20positives\7XNpLX0.png 1 0 0 28 20
我需要每行一个条目,如:
positives\3LiIIH8.png 1 0 0 28 20
positives\5NoLpfy.png 1 0 0 28 20
positives\7XNpLX0.png 1 0 0 28 20
\ n打破sintax