function _drush_escapeshellarg_windows

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

Windows version of escapeshellarg().

Related topics

1 call to _drush_escapeshellarg_windows()
drush_escapeshellarg in includes/
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. Use raw to get an unquoted version of the…


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


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

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

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

  // Only wrap with quotes when needed.
  if (!$raw) {
    // Add surrounding quotes.
    $arg = '"' . $arg . '"';

  return $arg;