0

I have an "error" in my batch file and volatility (in command prompt). I want to run it in a thumbdrive (still testing) but the error just looks super weird

In my batch file (MyBatchFile.bat)

E:   
vol231.exe -f E:\USER-PC-20140707-141900.raw imageinfo > Volatility.txt
exit

In java coding (using elicpse)

import java.io.*;
public class Run3
{
public static void main(String args[])
    {       
        try 
        {
            Runtime rt = Runtime.getRuntime();
            Process p = rt.exec("cmd /c start E:\\MyBatchFile.bat");
        } 
        catch (IOException e)
        {
            e.printStackTrace();
        }
    }
}

Everything looks fine here. And it can run too. But when the command prompt comes the volatility part. I don't know why. The command would become like this (see below).

vol231.exe -f E:\USER-PC-20140707-141900.raw imageinfo 1> Volatility.txt

I don't know where the hell the "1" comes from. and this affected my memory analysis. I wanted to try coding using java whereby everything just analysed on its own when I run the program. Still trying.

But then... Can anyone help me with this error for now? This problem has squeezed out all my brain juice!

Any help would be greatly appreciated!!! Thanks in advance.

Cheers,
Linify

Linify
  • 227
  • 4
  • 13

1 Answers1

0

Output in as for example in a windows shell can to go stdout or stderr. You redirect with > file. Doing so results in redirect stdout to the file. If you want redirect stdout and stderr you adress them with a number. 1 for stdout 2 for stderr. if omitting the number default is 1 stdout.

When excute for example

echo "Frodo" > test.txt

the text frodo is written to test.txt. But also the command shell echos what you did. it echoes:

echo "Frodo" 1> test.txt

the 1 is to remind that the output of stdout is captured and not stderr.

With your script is nothing wrong.

When I remember right you can turn the command echoing of in the batch with

@echo off.

Hope this helps.

Hank Lapidez
  • 1,857
  • 18
  • 23
  • I tried. If I use echo on and off, it does affect with the additional "1". From ur example, both still prints "Frodo" into the test.txt. But when I run my volatility command (with echo on), it creates a volatility.txt but nothing is written into it. Is it because my command is not an echo? – Linify Jul 13 '14 at 15:10
  • 'echo on' does not exists. this is default. @echo off can be used but it must be on its own line. What do you want to achieve? – Hank Lapidez Jul 13 '14 at 15:22
  • It's ok! My problem is solved. This analysis takes 50mins to confirm! I think it should be ok after your help! :D – Linify Jul 13 '14 at 15:31