33 releases

0.3.0 Apr 30, 2019
0.2.7 Jan 17, 2019
0.2.5 Dec 10, 2018
0.2.4 Nov 17, 2018
0.1.6 Nov 3, 2017

#24 in Text processing

Download history 1154/week @ 2019-01-15 860/week @ 2019-01-22 511/week @ 2019-01-29 916/week @ 2019-02-05 424/week @ 2019-02-12 364/week @ 2019-02-19 799/week @ 2019-02-26 514/week @ 2019-03-05 766/week @ 2019-03-12 919/week @ 2019-03-19 582/week @ 2019-03-26 584/week @ 2019-04-02 350/week @ 2019-04-09 523/week @ 2019-04-16 331/week @ 2019-04-23

2,493 downloads per month
Used in 1 crate


582 lines


crates.io Build Status Build status codecov
license Libraries.io for GitHub Documentation downloads
Built with cargo-make

Coverts simple basic shell scripts to windows batch scripts.


While it is not really possible to take every shell script and automatically convert it to a windows batch file, this library provides a way to convert simple basic shell commands to windows batch commands.
The original goal of this library is to provide users of cargo-make a way to write simple tasks with shell scripts without duplicating their code for each platform.


Simply include the library and invoke the convert function as follows:

extern crate shell2batch;

fn main() {
    let script = shell2batch::convert(
        export FILE1=file1
        export FILE2=file2

        #this is some test code
        cp ${FILE1} $FILE2

        mv file2 file3

        export MY_DIR=directory

        #flags are supported
        rm -Rf ${MY_DIR}

        unset MY_DIR

set FILE1=file1
set FILE2=file2

@REM this is some test code
xcopy %FILE1% %FILE2%

@REM another
move file2 file3

set MY_DIR=directory

@REM flags are supported
rmdir /S /Q %MY_DIR%

set MY_DIR=

    println!("Script: {}", script);


In order to use this library, just add it as a dependency:

shell2batch = "*"

API Documentation

See full docs at: API Docs


See contributing guide

Release History

Date Version Description
2019-04-30 v0.3.0 Convert '/' to '' in command arguments
2018-08-30 v0.2.0 Fix remove directory command #1
2017-10-24 v0.1.4 Variable replacement support.
2017-10-22 v0.1.2 Added command flags replacements.
2017-10-21 v0.1.0 Initial release.


Developed by Sagie Gur-Ari and licensed under the Apache 2 open source license.


~32K SLoC