<< Click to Display Table of Contents >> Navigation: Code Virtualizer > FAQ > General > I want to include Code Virtualizer in my build system. Does Code Virtualizer support command line protection? |
Code Virtualizer can be used to protect your files through the command line in order to include the protection of your application on all of your build systems.
First you need to create a Code Virtualizer project file (.cv). To create this project file, you need to start the Code Virtualizer user interface and set up the protection options that you want to include in your application. After that you can invoke the following command in the command line to protect your application:
Virtualizer.exe /protect YourProjectFile.cv
One of the following codes will be returned:
0 protection was successful.
1 Project file does not exist or invalid.
2 File to protect cannot be opened.
3 File do not have any blocks to protect.
4 Error in inserted block.
5 Fatal error while protecting file.
6 Cannot write protected file to disk.
Note: When command line protection is invoked under Windows XP, you will be able to see information about each protection stage in the current console.
Protecting different applications with a specific project file
You can reuse a specific project file to protect different applications, ignoring the application that is specified in your project file. You have to invoke Code Virtualizer from the command line as follow:
Virtualizer.exe /protect YourProjectFile.cv /inputfile OriginalApplication.exe /outputfile ProtectedApplication.exe
Load a project file from the command line
Code Virtualizer also allows you to load a project file into the user interface through the command line. To do this you have to invoke Code Virtualizer in the following way:
Virtualizer.exe YourProjectFile.cv
After this, the Code Virtualizer user interface will appear with all the information contained in your project file and will be ready to protect your applications.
Example of command line processing in a BAT file
The following example shows a BAT file that can be included in your build system to protect your applications through the command line:
@echo off
start /w virtualizer.exe /protect YourProjectFile.cv
if errorlevel 0 goto 0 if errorlevel 1 goto 1 if errorlevel 2 goto 2 if errorlevel 3 goto 3
goto done
:0
echo Application protected successfully
goto done
:1
echo ERROR: File already protected
goto done
:2
echo ERROR: File to protect cannot be opened
goto done
:3
echo ERROR: No blocks to protect found
:done |