function _drush_escapeshellarg_windows

8.0.x exec.inc _drush_escapeshellarg_windows($arg, $raw = FALSE)
6.x exec.inc _drush_escapeshellarg_windows($arg)
7.x exec.inc _drush_escapeshellarg_windows($arg, $raw = FALSE)
4.x drush.inc _drush_escapeshellarg_windows($arg)
5.x exec.inc _drush_escapeshellarg_windows($arg)
master startup.inc _drush_escapeshellarg_windows($arg, $raw = FALSE)

Windows version of escapeshellarg().

Related topics

1 call to _drush_escapeshellarg_windows()
drush_escapeshellarg in includes/exec.inc
Platform-dependent version of escapeshellarg(). Given the target platform, return an appropriately-escaped string. The target platform may be omitted for args that are /known/ to be for the local machine.

File

includes/exec.inc, line 328
Functions for executing system commands. (e.g. exec(), system(), ...).

Code

function _drush_escapeshellarg_windows($arg) {
  // Double up existing backslashes
  $arg = preg_replace('/\\\/', '\\\\\\\\', $arg);

  // Double up double quotes
  $arg = preg_replace('/"/', '""', $arg);

  // Double up percents.
  $arg = preg_replace('/%/', '%%', $arg);

  // Add surrounding quotes.
  $arg = '"' . $arg . '"';

  return $arg;
}