从执行的Andr​​oid .bat文件 [英] execute .bat file from android

查看:193
本文介绍了从执行的Andr​​oid .bat文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图执行xxx.bat文件将文件从我的Andr​​oid应用程序命名
听到是我的code

i am trying to execute the xxx.bat file for rename the file from my Android app and hear is my code

  Runtime.getRuntime().exec(Environment.getExternalStorageDirectory()+File.separator+"eduapp"+File.separator+"lock1.bat");

eduapp是目录和lock1.bat是我的bat文件和它的含量

eduapp is Directory and lock1.bat is my bat file and content of it

ren /sdcard/eduapp .{ED7BA470-8E54-465E-825C-99712043E01C}

但是当我运行程序的时候,阵痛错误,如..

but when i run app it throes error like..

java.io.IOException: Error running exec(). Command: [/mnt/sdcard/eduapp/lock1.bat] Working Directory: null Environment: null

基本上我要隐藏一些SD卡的文件夹。
是他们的任何花药的方式来运行的.bat或SD卡隐藏的文件夹。

basically i want to hide some folder from sdcard . is their any anther way to run .bat or hide folder from sdcard .

推荐答案

由于蝙蝠是DOS批处理文件,而Android基于linux?..
这是MV',而不是'仁'。它不是蝙蝠',它的'.SH'(但没关系,其实)。此外,你必须运行/ bin / sh的,并通过脚本文件作为参数,或者运行MV直接与参数 - 你不能Exec的文本文件。
但我敢肯定的Java有它自己的功能,移动文件,也没有必要为shell脚本。

Because .bat is dos batch files, while android based on linux?.. It's 'mv', not 'ren'. It's not '.bat', it's '.sh' (but it doesn't matter, in fact). Also, you have to run /bin/sh and pass script file as parameter, or run 'mv' directly with parameters - you can't exec text file. But i'm sure java have it's own functions to move files, there is no need for shell scripts.

这篇关于从执行的Andr​​oid .bat文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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