BatRT – Running batch files from WinRT

BatRT logoDownload link at bottom of post.

WinRT is the new application architecture which Windows store apps utilize. WinRT sandboxes applications to decrease the security issues which have plagued windows for many years. This severely limits what you are able to do from a windows store app. This stops store apps from launching desktop applications for example. File operations are also difficult to perform outside of the application’s personal folders.

There is however one loop hole, URIs. By calling a URI you can run an application which is associated with a certain protocol.

BatRT is an application which allows a batch file to executed from a WinRT application.

This allows a store app to compose a batch file within it’s application folder and then have that executed outside of the WinRT architecture – bypassing the constraints of WinRT. Below is a small C# code sample showing how easy it is to compose and run a batch file from using BatRT:

StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
StorageFile batFile = await local.CreateFileAsync("command.bat", CreationCollisionOption.ReplaceExisting);
using (var outputStream = await batFile.OpenStreamForWriteAsync())
	using (var sw = new StreamWriter(outputStream, Encoding.GetEncoding("us-ascii")))
		sw.Write("@ECHO OFF\nECHO testing BatRT");
string command = "BatRT://" + batFile.Path;
bool success = await Windows.System.Launcher.LaunchUriAsync(new Uri(command));
if (success)
	// batch file executed
	// batch execution failed

Click below to download BatRT. Install and usage information is included within the zip file.

This tool should not be used for malicious applications, please use sensibly and legally – Agree and download


    This entry was posted in Downloads. Bookmark the permalink. Both comments and trackbacks are currently closed.