I heard that java code cannot be to add into batch file in a comment on my previous question:
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(new File(d.detectDrive())) imageinfo > Volatility.txt
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.
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?
I am new to java and batch file.
Edit1:
I tried changing the java_path but it still have errors.
Edit2: I tried different paths like:
C:\Program Files\Java\jdk1.8.0_05\bin
andC:\Program Files\Java\jre8\bin
I getError: Could not find or load main class TestRun1
.C:\Users\User\workspace\Volatility\bin
andC:\Users\User\workspace\Volatility\src
(this is the workspace where the class is saved) I getC:\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 toError: Could not find or load main class TestRun1
.
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.