Batch files cannot access boxed files

Issues related to Enigma Virtual Box
Post Reply
icydev
Posts: 2
Joined: Mon Apr 27, 2020 2:39 pm

Batch files cannot access boxed files

Post by icydev »

I am unable to access boxed files with batch files, may I know if I have done anything wrong? I have checked all the 3 options in Options. Attached the source for testing, tools.exe is converted from tools.cmd with "Bat to Exe Converter", it simply launch notepad.exe and open lib\test.txt file.

tools.exe
tools.cmd
lib\test.txt

content of tools.cmd:
start notepad.exe "%~dp0lib\test.txt"

I pack the tools.exe to tools_boxed.exe then run in other place, the txt file cannot be found no matter I use ".\lib\test.txt" or "lib\test.txt" or "%~dp0lib\test.txt".

Please help, thanks.
You do not have the required permissions to view the files attached to this post.
Enigma
Site Admin
Posts: 2945
Joined: Wed Aug 20, 2008 2:24 pm

Re: Batch files cannot access boxed files

Post by Enigma »

Hi, unfortuntely, such files won't work on Windows x64 systems.

Let me explain. When you converted your file from .cmd to .exe, the .exe file becomes 32 bit executable file.
When you run .exe file, it then runs a CMD program that is 64 bit executable file on Windows x64 system.
Then 64 bit CMD process performs actions from your .cmd file, i.e. run notepad file.

The problem there is that Enigma Virtual Box can't share virtual system between processes of different types, i.e. between 32 and 64 processes. To share virtual system between processes, all of them should be either 32 either 64 bit.

What would be a solution - do not use batch to exe converter. Instead you can develop a simple program Delphi, C#, C++ or any other programming language that will run notepad.exe with necessary parameters, it will work well.
icydev
Posts: 2
Joined: Mon Apr 27, 2020 2:39 pm

Re: Batch files cannot access boxed files

Post by icydev »

I convert the .cmd to 64bit exe then it is able to list the Virtual Folders and Files.
start notepad.exe ".\lib\test.txt" is still not working but then I realize notepad.exe is a "outside process" which cannot view the Virtual files.

I think I know the way now.
Thanks for the prompt reply and all the works on this great program.
Enigma
Site Admin
Posts: 2945
Joined: Wed Aug 20, 2008 2:24 pm

Re: Batch files cannot access boxed files

Post by Enigma »

This way it should work, so when exe you protect + cmd.exe + notepad.exe all are 64 bit processes, then Enigma will be able to share virtual files between them.
But make sure that the option "Share virtual system to child processes" is enabled.
Post Reply