Java cmd常用命令_常用windowscommand及java调用命令行操作

c3de63d5ba3f1e30f7475d918f26204c.png

常用windows command及java调用命令行操作

安装软件

1.安装ImageMagick-6.2.9-4-Q8-windows-dll.exe

set pathc:\program files\imagemagick-6.2.9q8;

2.安装iview410_setup.exe

set PathC:\Program Files\IrfanView;

3.安装插件irfanview_plugins_410_setup.exe

4.附助iview410_setup.exe,处理特珠的eps,tif文件

4.解压缩 7z457.exe

set pathC:\Program Files\7-Zip;

//开发中常有的命令

创建目录 mkdir "f:\temp"

创建文件 copy "f:\giga-805-0002.eps" "f:\615.eps"

解压缩 7z x -y "f:\testpc.zip" -o"f:\TODO\temp"

解压缩一个文件到临时目录 rar x "F:\testpc\testpc.rar" n "fait00\68751_VerresXL.eps" "F:\temp"

解压缩 一张图片 7z x -y "f:\test.zip" -o"f:\temp" "test.jpg" -r

不按比例生成缩略图 convert "f:\629.eps" -resize 68x68! "F:\629.gif"

按比例生成缩略图 convert "f:\629.eps" -resize 68x68 "F:\629.gif"

不按比例生成缩略图 i_view32.exe "f:\635.eps" /resize(68,68) /resample /convert"F:\635.gif"

按比例生成缩略图 i_view32.exe "f:\628.eps" /resize(600,600) /aspectratio /resample /convert"F:\628.gif"

获得图片大小比例 identify -format "%wx%h" "f:\627.jpg"

移动目录到目录 move "f:\hidden\rr\*" "f:\FAIT\rr"

移动文件到文件 move "f:\hidden\275.jpg" "f:\FAIT\275.jpg"

删除目录 rd "f:\hidden\rr"

删除某个文件 del 1.txt

more 1.txt

清除目录 rd /Q /s "f:\home\localuser\TODO\temp"

支持命令生成缩略图软件

支持库http://irfanview.tuwien.ac.at/plugins/irfanview_plugins_410.zip

解压后放在C:\Program Files\IrfanView\Plugins

命令行形式

http://www.xs4all.nl/~samzen/download/iview/iv_options.txt

http://www.student.oulu.fi/~vtatila/batch_tutorial.html

备份数据库

mysqldump -u root -B simatai>"F:\test.sql"

备份网站

7z a -tzip "F:/moon-%date%.zip" -xr!"*.jar" -xr!"*__jsp.*" -ir!"F:\WebRoot\admin\" -ir!"F:\WebRoot\WEB-INF\"

每天备份 排除*.jar,*__jsp.*文件,包含目录F:\WebRoot\admin\,F:\WebRoot\WEB-INF\

java中对命令行的操作

public static boolean exeCommand(String cmd, String msg) {

boolean result true;

log.debug(cmd);

Process process null;

try {

String[] cmdary {"cmd", "/C", cmd};

process Runtime.getRuntime().exec(cmdary);

StreamGobbler errorGobbler new StreamGobbler(process.getErrorStream(), "Error");

StreamGobbler outputGobbler new StreamGobbler(process.getInputStream(), "Output");

errorGobbler.start();

outputGobbler.start();

if (errorGobbler.is.read() ! -1) {

result false;

}

process.waitFor();

} catch (Exception e) {

log.debug("execute commond failed : " + e);

result false;

}

if (!result) {

log.debug(msg + " failed");

}

return result;

}

class StreamGobbler extends Thread {

Log log LogFactory.getLog(StreamGobbler.class);

InputStream is;

String type;

StreamGobbler(InputStream is, String type) {

this.is is;

this.type type;

}

public void run() {

try {

InputStreamReader isr new InputStreamReader(is);

BufferedReader br new BufferedReader(isr);

String line null;

while ((line br.readLine()) ! null) {

if (type.equals("Error"))

log.debug(line);

else

log.debug(line);

}

} catch (IOException ioe) {

ioe.printStackTrace();

}

}

}

2829f2ca24f0d0090cbba57f30759f23.png

常用windowscommand及java调用命令行操作.doc

下载Word文档到电脑,方便收藏和打印[全文共1754字]

编辑推荐:

8b95f2eb3d3f7ce4dc3bf1178c74941e.png

8b95f2eb3d3f7ce4dc3bf1178c74941e.png

8b95f2eb3d3f7ce4dc3bf1178c74941e.png

8b95f2eb3d3f7ce4dc3bf1178c74941e.png

8b95f2eb3d3f7ce4dc3bf1178c74941e.png

下载Word文档

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值