World Map
Java Service Wrapper is the easiest way to make your product more reliable.
  • Free Trial
  • Buy Now

Why does Windows prevent batch files from executing?

Description of the problem

On Windows, depending on the security policy of your system, a popup window titled "Windows protected your PC" may appear when trying to execute the batch files located in the bin folder.

The popup reports that "Windows Defender SmartScreen prevented an unrecognized app from starting":

If you click on "More Info", a "Run anyway" button will appear leaving the possibility to execute the batch file. The popup will take the following appearance:

Once the batch file is executed, the popup will not show up on subsequent executions.

Reason

We provide number of batch files to ease launching and controling the Wrapper on Windows. Their role is simply to build a command line (using the variables listed on the top of the script) in order to launch the wrapper.exe with the appropriate command and parameters.

The above popup is a security precaution that Windows SmartScreen takes when it detects that a file comes from a different computer. Although the Wrapper binaries have been signed to verify that they are unmodified as published by Tanuki Software, SmartScreen has no ability to parse the batch files and know that they are just launchers for the trusted "wrapper.exe". Batch files by nature can't be signed like exe files, and thus Windows has no way to confirm whether their origin and execution are safe or not.

Please be reassured, it is perfectly safe to execute them if they were acquired from the download page of the Tanuki Software website or the Official "Java Service Wrapper" SourceForge page.

Workarounds

There are a few solutions that we recommend as a workaround to this issue:

The first solution is to simply click "More Info" and then "Execute anyway" when the popup appears, as described in the first section of this page.

The second solution is to:
1. Right click on the bat file you want to execute and open the Properties window from the contextual menu.
2. At the bottom of the "General" tab, you should see a "Security" section with an "Unblock" checkbox or button. Click on the button or check the box.
3. Click OK.
4. You should now be able to execute the BAT file without warning.

The third solution is to do the same on the downloaded zip file before extracting it. All of the extracted files will maintain the unblocked status.

NOTE

It is also possible to change the security policy of your system to never show this popup, but we don't recommend this solution as this will apply to all programs executed on the machine, decreasing the whole security level of the machine.