Execute Batch file in Windows Subsystem for Linux

Unfortunately at the moment you cannot do so without either using: cmd.exe /c foo.bat …or the following hack using binfmt: sudo sh -c “echo :WindowsBatch:E::bat::/init: > /proc/sys/fs/binfmt_misc/register” You could then just type: foo.bat The problems with this method are that you’d need to be root, run it each time you opened a bash window, probably … Read more

How do I get the equivalent of dirname() in a batch file?

for %%F in (%filename%) do set dirname=%%~dpF This will set %dirname% to the drive and directory of the file name stored in %filename%. Careful with filenames containing spaces, though. Either they have to be set with surrounding quotes: set filename=”C:\MyDir\MyFile with space.txt” or you have to put the quotes around the argument in the for … Read more

How to display text on the screen without a window using Python

It turns out there are two entirely different problems here. To show text over windows, you’ll need to create an undecorated topmost window and chroma key the background. However, this won’t work when there’s a full-screen application running (such as a game). The only reliable way to show text over a full-screen application is to … Read more

How to get Windows native look for the .NET TreeView?

You need to P/Invoke to call SetWindowTheme passing the window handle of the tree and use “explorer” as the theme. Paste the following code into a new class in your project, compile, and use this custom control instead of the built-in TreeView control. C#: public class NativeTreeView : System.Windows.Forms.TreeView { [DllImport(“uxtheme.dll”, CharSet = CharSet.Unicode)] private … Read more

Quartz.NET vs Windows Scheduled Tasks. How different are they?

With Quartz.NET I could contrast some of the earlier points: Code to write – You can express your intent in .NET language, write unit tests and debug the logic Integration with event log, you have Common.Logging that allows to write even to db.. Robust and reliable too Even richer API It’s mostly a question about … Read more

What version of the .NET framework is installed on Windows XP, Vista, and 7?

From Wikipedia and MSDN: .NET Framework 1.1: Windows Server 2003 .NET Framework 2.0: Windows Server 2003 R2 .NET Framework 3.0: Windows Vista, Windows Server 2008 .NET Framework 3.5: Windows 7, Windows Server 2008 R2 .NET Framework 4.0: n/a .NET Framework 4.5: Windows 8, Windows Server 2012 .NET Framework 4.5.1: Windows 8.1, Windows Server 2012 R2 … Read more

How to open a Windows named pipe from Java?

Use Named Pipes to Communicate Between Java and .Net Processes Relevant part in the link try { // Connect to the pipe RandomAccessFile pipe = new RandomAccessFile(“\\\\.\\pipe\\testpipe”, “rw”); String echoText = “Hello word\n”; // write to pipe pipe.write ( echoText.getBytes() ); // read response String echoResponse = pipe.readLine(); System.out.println(“Response: ” + echoResponse ); pipe.close(); } … Read more