Skip to content

Instantly share code, notes, and snippets.

@vendettamit
Created September 17, 2019 16:31
Show Gist options
  • Save vendettamit/b7e28de40f1a174d1ff08e7a96c07fac to your computer and use it in GitHub Desktop.
Save vendettamit/b7e28de40f1a174d1ff08e7a96c07fac to your computer and use it in GitHub Desktop.
//Escape special characters in a string to use in batch file
var arg = "^hU$xgjX4ku*Hc0p%#F^UH";
arg.replace(/([\(\)%!\^<>|;, ])/g,'^$1').replace(/&/g, '&&');
console.log(arg);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment