This topic was published by DevynCJohnson and viewed 2139 times since "". The last page revision was "".
- Topics - 443
Windows batch files can be run on Linux like shell scripts. First the user must have Wine installed. Then, download the file below. After extracting the file, move it to /usr/bin/ or /usr/share/bin/. Be sure that the file is named "winescript" and is executable.
Below is an example. Use Root privileges when executing the below commands.
mv ./winescript /usr/share/bin/winescript chmod +x /usr/share/bin/winescript
In the batch file on the Linux system, place "#!/usr/bin/env winescript" in the file as the first line. Then, make the batch file executable (
chmod +x ./batchfile.bat).
Now, the batch file can be executed as if it were running on a Windows system.
Winescript is made by Devyn Collier Johnson and is Public Domain (CC0)
Example batch file
#!/usr/bin/env winescript @ECHO off ECHO Hello World! PAUSE
Winescript Source Code
#!/bin/sh # -*- coding: utf-8 -*- # vim:fileencoding=utf-8 # Created by Devyn Collier Johnson # <DevynCJohnson@Gmail.com> # dcjtech.info # Version 2015.02.08 # Public Domain (CC0) # creativecommons.org/publicdomain/zero/1.0/ # creativecommons.org/about/cc0 FILE=/tmp/script_$(date "+%s%N").bat tail -n +2 $1 > $FILE wine cmd.exe /c $FILE rm $FILE echo "" exit