将基于Unix的PHP脚本转换为Windows的批处理文件

I want to convert this PHP script which works great on a Unix system into a script for Windows.

I don't know how to rewrite it. Can someone help me?

Here is the script:

$cmd = 'nohup sudo -u '.$user.' bash -c "cd ' .
escapeshellarg($path) . '; VVERBOSE=true QUEUE=' .
escapeshellarg($queue) . ' APP_INCLUDE=' .
escapeshellarg($bootstrap_path) . ' INTERVAL=' .
escapeshellarg($interval) . ' CAKE=' .
escapeshellarg(CAKE) . ' COUNT=' . $count .
' php ./resque.php';
$cmd .= ' > '. escapeshellarg($log_path).' 2>&1" >/dev/null 2>&1 &';

passthru($cmd);

passthru is a method in PHP see http://php.net/manual/en/function.passthru.php

Do you know what the script does? Maybe reverse engineer it into windows batch script?

From the looks of it, the script came from a *nix system it:

  • execute a command as another user
  • change the current directory
  • set environment variables
  • calls a PHP script directly from the PHP interpreter and dumps the log into a file, and pipes the stderrs to /dev/null

That script is imo, is impossible to "covert" to Windows batch script (since Windows != POSIX), you need to rewrite it.