命令如下:
type c:
.txt | perl c:\mail.pl -s "Subject" -f [email protected] [email protected]" type c:
.txt | perl c:\mail.pl -s
type c:
命令如下:
type c:\1.txt | perl c:\mail.pl -s "Subject" -f [email protected] [email protected]"
我需要将上面的内容当作一个整体来运行(就是说把内容都输入到CMD里后,再按回车一起执行)
1. 手动在CMD里输入以上脚本,运行可以达到这个效果。
2. 将上面的内容存放到BAT文件里,Runtime.getRuntime().exec("cmd.exe /k start " + batFile)也可以。
问题来了,当我把该命令定义成一个String,然后Runtime.getRuntime().exec("cmd.exe /k start " + command)
执行效果如下:
type c:\1.txt 回车
| 回车
perl 回车
c:\mail.pl 回车
"Subject" 回车
-f 回车
[email protected] 回车
[email protected] 回车
我的期待效果是:
type c:\1.txt | perl c:\mail.pl -s "Subject" -f [email protected] [email protected] 回车
谁知道是哪里弄错了吗?
type c:\1.txt | perl c:\mail.pl -s "Subject" -f [email protected] [email protected]"
我需要将上面的内容当作一个整体来运行(就是说把内容都输入到CMD里后,再按回车一起执行)
1. 手动在CMD里输入以上脚本,运行可以达到这个效果。
2. 将上面的内容存放到BAT文件里,Runtime.getRuntime().exec("cmd.exe /k start " + batFile)也可以。
问题来了,当我把该命令定义成一个String,然后Runtime.getRuntime().exec("cmd.exe /k start " + command)
执行效果如下:
type c:\1.txt 回车
| 回车
perl 回车
c:\mail.pl 回车
"Subject" 回车
-f 回车
[email protected] 回车
[email protected] 回车
我的期待效果是:
type c:\1.txt | perl c:\mail.pl -s "Subject" -f [email protected] [email protected] 回车
谁知道是哪里弄错了吗?
3 个解决方案
#1
楼主你的问题都很复杂了
#2
不复杂 不复杂 谁帮帮忙啊
#3
你可以用 &&
c:\1.txt && perl && ................
c:\1.txt && perl && ................
.txt | perl c:\mail.pl -s "Subject" -f [email protected] [email protected]" type c:
命令如下:
type c:\1.txt | perl c:\mail.pl -s "Subject" -f [email protected] [email protected]"
我需要将上面的内容当作一个整体来运行(就是说把内容都输入到CMD里后,再按回车一起执行)
1. 手动在CMD里输入以上脚本,运行可以达到这个效果。
2. 将上面的内容存放到BAT文件里,Runtime.getRuntime().exec("cmd.exe /k start " + batFile)也可以。
问题来了,当我把该命令定义成一个String,然后Runtime.getRuntime().exec("cmd.exe /k start " + command)
执行效果如下:
type c:\1.txt 回车
| 回车
perl 回车
c:\mail.pl 回车
"Subject" 回车
-f 回车
[email protected] 回车
[email protected] 回车
我的期待效果是:
type c:\1.txt | perl c:\mail.pl -s "Subject" -f [email protected] [email protected] 回车
谁知道是哪里弄错了吗?
type c:\1.txt | perl c:\mail.pl -s "Subject" -f [email protected] [email protected]"
我需要将上面的内容当作一个整体来运行(就是说把内容都输入到CMD里后,再按回车一起执行)
1. 手动在CMD里输入以上脚本,运行可以达到这个效果。
2. 将上面的内容存放到BAT文件里,Runtime.getRuntime().exec("cmd.exe /k start " + batFile)也可以。
问题来了,当我把该命令定义成一个String,然后Runtime.getRuntime().exec("cmd.exe /k start " + command)
执行效果如下:
type c:\1.txt 回车
| 回车
perl 回车
c:\mail.pl 回车
"Subject" 回车
-f 回车
[email protected] 回车
[email protected] 回车
我的期待效果是:
type c:\1.txt | perl c:\mail.pl -s "Subject" -f [email protected] [email protected] 回车
谁知道是哪里弄错了吗?
3 个解决方案
#1
楼主你的问题都很复杂了
#2
不复杂 不复杂 谁帮帮忙啊
#3
你可以用 &&
c:\1.txt && perl && ................
c:\1.txt && perl && ................
.txt | perl c:\mail.pl -s