Skip to content

Instantly share code, notes, and snippets.

@KenDB3
Last active November 10, 2019 12:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save KenDB3/2bd29f5108e189fae9abd303ce1d9960 to your computer and use it in GitHub Desktop.
Save KenDB3/2bd29f5108e189fae9abd303ce1d9960 to your computer and use it in GitHub Desktop.
Windows Batch File that takes a quoted text command line argument, removes the quotes, and replaces spaces with underscores
@ECHO OFF
REM Windows Batch File that takes a quoted text command line argument,
REM removes the quotes, and replaces spaces with underscores.
REM This is useful for passing an argument to another program.
REM Change Directory to where the Batch file is saved
CD /d "%~dp0"
set originalquotedtextwithspaces=%1
set noquotes=%originalquotedtextwithspaces:"=%
set withunderscores=%noquotes: =_%
SomeProgram.exe %withunderscores%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment