hackoo

Replacing_SmartQuotes.bat

Aug 13th, 2020 (edited)
993
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo off
  2. Color 0A & Mode 80,4
  3. Title Replacing Smart Quotes with Powershell and Batch by Hackoo 2020
  4. Set "InputFile=%~1"
  5. If "%InputFile%" EQU "" Goto :Help
  6. Set "OutPutFile=%~dpn1_output.txt"
  7. echo(
  8. echo(      Please wait a while ... Replacing Smart Quotes for "%~nx1"
  9. REM ------------------------------------------------------------------------------------------------------------------------------
  10. :Replace_SmartQuotes <InputFile> <OutPutFile>
  11. Powershell ^
  12. (GC '"%InputFile%"'^) ^
  13. | %% { $_=[regex]::Replace($_,'[\u2019\u2018]', \"'\"); [regex]::Replace($_,'[\u201C\u201D]','\"')} | Set-Content '"%OutPutFile%"'
  14. REM ------------------------------------------------------------------------------------------------------------------------------
  15. If Exist "%OutPutFile%" Start /Max "" "%OutPutFile%" & Exit
  16. REM --------------------------------------------------------
  17. :Help
  18. Color 0C
  19. echo(
  20. echo(     You should drag and drop a file over,
  21. echo(     this script "%~nx0" for Replacing Smart Quotes !
  22. Timeout /T 10 /NoBreak>nul
  23. Exit
  24. REM --------------------------------------------------------
RAW Paste Data