替代批处理文件,因为我无法包含的Java code在它 [英] alternatives to batch file since i am unable to include java code in it

查看:122
本文介绍了替代批处理文件,因为我无法包含的Java code在它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我听说的Java code不能添加到批处理文件上的我的previous问题:

I heard that java code cannot be to add into batch file in a comment on my previous question:

但是否有任何替代它?结果
是否可以添加Java code到批处理文件?

But is there any alternatives to it?
Is it possible to add java code into batch file?

我试过在批处理文件下面,但它不工作:

I tried the following in the batch file but it does not work:

vol231.exe -f m.walkin(新文件(d.detectDrive()))的imageinfo> Volatility.txt

vol231.exe -f m.walkin(new File(d.detectDrive())) imageinfo > Volatility.txt

这是我创建从Java在命令提示符下运行cmdenv.bat:

This is cmdenv.bat that i created to run in command prompt from java:

E:
echo off
cls

... //This part is a long part for reducing footprint whereby the command prompt is switched to Helix

vol231.exe -f E:\KOHMOHOJOJO-PC-20140714-152414.raw imageinfo > Volatility.txt
vol231.exe -f E:\KOHMOHOJOJO-PC-20140714-152414.raw --profile=Win7SP0x86 pslist >> Volatility.txt
pause
exit

这让我的命令波动在一个封闭的命令提示符(螺旋)减少占用空间运行。

This allows my volatility commands to run in a enclosed command prompt (Helix) which reduces footprint.

不过,波动性命令是所有硬盘codeD。在 E:\\ KOHMOHOJOJO-PC-20140714-152414.raw - 配置= Win7SP0x86 变化。是否有任何替代做到这一点,因为批处理文件并允许Java编码?

However, the volatility commands are all hardcoded. The E:\KOHMOHOJOJO-PC-20140714-152414.raw and --profile=Win7SP0x86 varies. Is there any alternative to do it since batch file does allow java coding?

我是新来的Java和批处理文件。

I am new to java and batch file.

EDIT1:

我试图改变JAVA_PATH,但它仍然有错误。

I tried changing the java_path but it still have errors.

EDIT2:
我喜欢尝试不同的路径:

I tried different paths like:


  1. C:\\ Program Files文件\\的Java \\ jdk1.8.0_05 \\ BIN C:\\ Program Files文件\\的Java \\ jre8 \\斌
    我得到错误:无法找到或加载主类TestRun1

C:\\用户\\用户\\工作区\\波动\\ BIN C:\\用户\\用户\\工作区\\波动的\\ src (这是类保存工作区),我得到 C:\\用户\\用户\\工作区\\波动率\\(垃圾桶或SRC)\\ java中不被识别为一个内部或外部命令,可操作的程序或批处理文件。所以,我的java.exe添加到文件中。和错误回来到错误:无法找到或加载主类TestRun1

C:\Users\User\workspace\Volatility\bin and C:\Users\User\workspace\Volatility\src (this is the workspace where the class is saved) I get C:\Users\User\workspace\Volatility\(bin or src)\java is not recognised as an internal or external command, operable program or batch file. So I added java.exe into the file. And the error gets back to Error: Could not find or load main class TestRun1.

该批处理文件似乎并不能够读取java的。我尝试添加一个 TestRun1 code>,但仍然有同样的错误。我还发现,我在安全\\系统\\高级系统设置\\环境变量环境变量控制面板\\系统和(路径)。我试着删除 C:\\ Program Files文件\\的Java \\ jdk1.8.0_05 \\ BIN ,然后运行它,但它仍具有相同的错误

This batch file doesn't seem to be able to read the java.. I tried adding a . in front of the TestRun1 but still it has the same error. I also found out that I have the environment variable under Control Panel\System and Security\System\Advance System Settings\Environment Variables (Path). I tried deleting C:\Program Files\Java\jdk1.8.0_05\bin and then running it but it still has the same error.

推荐答案

上,您不能添加Java code到批处理文件。

So it is possible to add java code into batch file?

No, you cannot add Java code to batch file.

在Java中,

public class TestRun1
{
    public static void main(String args[])
    {
       System.out.println(m.walkin(new File(d.detectDrive())));
    }
}

在批处理文件:

set tmp_file=%TEMP%\%~n0.tmp

rem ----set as per your java directory-------
set java_path=C:\Program Files\Java\jdk1.6.0_43\bin

"%java_path%\java" TestRun1> "%tmp_file%"
set /P p=<"%tmp_file%"
echo %p%

rem -----now p has the value, use it in the command--------

vol231.exe -f %p% imageinfo > Volatility.txt
vol231.exe -f %p% --profile=Win7SP0x86 pslist >> Volatility.txt
vol231.exe -f %p% --profile=Win7SP0x86 dlllist > Volatility.txt
vol231.exe -f %p% --profile=Win7SP0x86 iehistory >> Volatility.txt
vol231.exe -f %p% --profile=Win7SP0x86 svcscan >> Volatility.txt
vol231.exe -f %p% --profile=Win7SP0x86 hivelist >> Volatility.txt
vol231.exe -f %p% --profile=Win7SP0x86 filescan >> Volatility.txt
vol231.exe -f %p% --profile=Win7SP0x86 netscan >> Volatility.txt
pause
del /F "%tmp_file%" 

这篇关于替代批处理文件,因为我无法包含的Java code在它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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