{"id":684,"date":"2013-11-11T08:28:23","date_gmt":"2013-11-11T07:28:23","guid":{"rendered":"http:\/\/sam-soul.fr\/Info\/?p=684"},"modified":"2013-11-11T08:28:23","modified_gmt":"2013-11-11T07:28:23","slug":"wamp-portable-bat","status":"publish","type":"post","link":"http:\/\/les-fougs.com\/wordpress\/2013\/11\/11\/wamp-portable-bat\/","title":{"rendered":"wamp-portable.bat"},"content":{"rendered":"<p>Copier-coller le contenu ci-apr\u00e8s dans un fichier que vous nommerez  <strong>wamp-portable.bat<\/strong><\/p>\n<pre>@ECHO OFF\nSETLOCAL EnableDelayedExpansion\n\n::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::\n::                                                                                ::\n::  Wamp Portable                                                                 ::\n::                                                                                ::\n::  A DOS Batch script to make WampServer portable.                               ::\n::                                                                                ::\n::  Copyright (C) 2012-2013 Cr@zy &lt;webmaster@crazyws.fr&gt;                          ::\n::                                                                                ::\n::  Wamp-Portable is free software; you can redistribute it and\/or modify         ::\n::  it under the terms of the GNU Lesser General Public License as published by   ::\n::  the Free Software Foundation, either version 3 of the License, or             ::\n::  (at your option) any later version.                                           ::\n::                                                                                ::\n::  Wamp-Portable is distributed in the hope that it will be useful,              ::\n::  but WITHOUT ANY WARRANTY; without even the implied warranty of                ::\n::  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the                  ::\n::  GNU Lesser General Public License for more details.                           ::\n::                                                                                ::\n::  You should have received a copy of the GNU Lesser General Public License      ::\n::  along with this program. If not, see http:\/\/www.gnu.org\/licenses\/.            ::\n::                                                                                ::\n::  Related post: http:\/\/goo.gl\/g0rWG                                             ::\n::  Usage: Just launch wamp-portable.bat in the same folder as wampmanager.exe    ::\n::                                                                                ::\n::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::\n\nCLS\nTITLE Wamp Portable v1.6\n\nECHO.\nECHO.\nECHO    #########################################################################\nECHO    #                                                                       #\nECHO    #   @   @ @@@@@ @   @ @@@@@ @@@@@ @@@@@ @@@@@ @@@@@ @@@@@ @     @@@@@   #\nECHO    #   @   @ @   @ @@ @@ @   @ @   @ @   @   @   @   @ @   @ @     @       #\nECHO    #   @   @ @@@@@ @ @ @ @@@@@ @   @ @@@@@   @   @@@@@ @@@@@ @     @@@@    #\nECHO    #    @@@  @   @ @   @ @     @   @ @  @    @   @   @ @   @ @     @       #\nECHO    #    @ @  @   @ @   @ @     @@@@@ @   @   @   @   @ @@@@@ @@@@@ @@@@@   #\nECHO    #                                                                       #\nECHO    #   Author : Cr@zy                               Date    : 09\/25\/2013   #\nECHO    #   Email  : webmaster@crazyws.fr                Version : 1.6          #\nECHO    #                                                                       #\nECHO    #########################################################################\n\n:: Wamp launcher\nSET wampLauncher=%TEMP%\\wampLauncher.vbs\nSET wampLauncherScript=%TEMP%\\wampLauncher.bat\nSET wampmanagerDaemon=%~dp0wampmanager.exe\n\n:: Get the latest version of PHP on Wamp\nFOR \/R bin\\php %%v IN (php.*exe) DO (\n    SET PHP=%%v\n)\n\n:: Run PHP\n%PHP% -n -d output_buffering=1 -f \"%~f0\"\nENDLOCAL\nEXIT \/b\n\n:: wampserver-portable PHP script\n<!--?php \n\nwhile(@ob_end_clean());\n\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n\/\/ Properties\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n\n$timezone = 'Europe\/Paris';\n$enableLogs = true;\n$autoLaunch = false;\n$purgeWampLogs = false;\n$maxBackups = 10;\n$verbose = 0;\n\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n\/\/ No edits necessary beyond this line\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n\ndate_default_timezone_set($timezone);\n\n$scriptName = basename(__FILE__);\n$wampConfigPath = getcwd() . '\\\\wampmanager.conf';\n$wampIniPath = getcwd() . '\\\\wampmanager.ini';\n$wampTplPath = getcwd() . '\\\\wampmanager.tpl';\n$wampLogsPath = getcwd() . '\\\\logs\\\\';\n$rootBackupPath = getcwd() . '\\\\backups\\\\';\n$backupsPath = $rootBackupPath . date('YmdHis');\n$logsPath = getcwd() . '\\\\wamp-portable.log';\n$tmpStdout = getcwd() . '\\\\wamp-portable.tmp';\n\nif ($enableLogs) file_put_contents($logsPath, \"@@@\\n@@@ START WAMP-PORTABLE \" . date('YmdHis') . \"\\n@@@\", FILE_APPEND);\n\nfunction echoListener($str) {\n    global $logsPath, $enableLogs;\n    if ($enableLogs) {\n        file_put_contents($logsPath, $str, FILE_APPEND);\n    }\n    echo $str;\n}\n\nfunction startWith($string, $search) {\n    $length = strlen($search);\n    return (substr($string, 0, $length) === $search);\n}\n\nfunction endWith($string, $search) {\n    $length = strlen($search);\n    $start  = $length * -1;\n    return (substr($string, $start) === $search);\n}\n\nfunction exitApp() {\n    echoListener(\"\\n\\An error occurred during the operation, exit...\");\n    echoListener(\"\\n\");\n    exit();\n}\n\nfunction logInfo($str, $status, $values=array(), $withKey=true, $withValue=true, $customError=false) {\n    global $verbose;\n    $count = strlen($str);\n    $dots = \"\";\n    for ($i=$count; $i<=50; $i++) {         $dots .= \".\";     }     if ($verbose -->= 1) {\n        echoListener(logTitle($str . \" \" . $dots . \" \" . ($status ? \"OK\" : ($customError === false ? \"KO\" : $customError))));\n        if (!empty($values) &amp;&amp; is_array($values)) {\n            foreach ($values as $key =&gt; $value) {\n                $count = strlen($key);\n                $spaces = \"\";\n                for ($i=$count; $i&lt;=7; $i++) {                     $spaces .= \" \";                 }                 echoListener(\"\\n\" . ($withKey ? $key : \"\") . ($withKey &amp;&amp; $withValue ? $spaces . \" : \" : \"\") . ($withValue ? $value : \"\"));             }         }     } else {         echoListener(\"\\n\" . $str . \" \" . $dots . \" \" . ($status ? \"OK\" : ($customError === false ? \"KO\" : $customError)));     }          if (!$status &amp;&amp; $customError === false) {         exitApp();     } } function logTitle($title) {     $logTitle = \"\\n\\n\\n\\n======================================================================\\n\";     $logTitle .= $title;     $logTitle .= \"\\n======================================================================\";     return $logTitle; } function execCommand($cmds, $echoStdout=true) {     global $verbose, $tmpStdout;     $logs = array();     $cmds = is_array($cmds) ? $cmds : array($cmds);     $stdout = \" &gt;\\\"\" . $tmpStdout . \"\\\" 2&gt;&amp;1\";\n    foreach($cmds as $cmd) {\n        $log = \"\";\n        if ($verbose &gt;= 1) echoListener(\"\\n&gt; \" . $cmd);\n        `$cmd$stdout`;\n        if (file_exists($tmpStdout)) {\n            $lines = file($tmpStdout, FILE_IGNORE_NEW_LINES);\n            foreach ($lines as $line) {\n                $line = trim($line);\n                if (!empty($line)) {\n                    $log .= $line . \"\\n\";\n                    if ($verbose == 2 &amp;&amp; $echoStdout) {\n                        echoListener(\"\\n\" . $line);\n                    }\n                }\n            }\n            if (!empty($log)) {\n                $logs[] = $log;\n            }\n            @unlink($tmpStdout);\n        }\n    }\n    return $logs;\n}\n\nfunction versionsAppList($dir, $substr, $bins) {\n    $appArr = array();\n    if (is_dir($dir) &amp;&amp; $appDirHandle = opendir($dir)) {\n        while (false !== ($appDirName = readdir($appDirHandle))) {\n            $appPath = getcwd() . \"\\\\\" . str_replace(\"\/\", \"\\\\\", $dir) . \"\\\\\" . $appDirName;\n            if ($appDirName != '.' &amp;&amp; $appDirName != '..' &amp;&amp; is_dir($appPath) ) {\n                $appVersion = substr($appDirName, $substr);\n                foreach ($bins as $bin) {\n                    $appBin = str_replace(\"\/\", \"\\\\\", $bin);\n                    if (is_file($appPath . '\\\\' . $appBin)) {\n                        $appArr[$appVersion] = array(\n                            'path'  =&gt;  $appPath,\n                            'bin'   =&gt;  $appBin\n                        );\n                    }\n                }\n            }\n        }\n        ksort($appArr, SORT_NUMERIC);\n    }\n    return $appArr;\n}\n\nfunction versionsAppPaths($list, $type) {\n    $paths = array();\n    foreach ($list as $versions =&gt; $value) {\n        if (count(array_keys($paths, $type . ';' . $value['path'])) == 0) {\n            $paths[] = $type . ';' . $value['path'];\n        }\n    }\n    return $paths;\n}\n\nfunction foundFiles($path, $toFound) {\n    $files = array();\n    if ($handle = opendir($path)) {\n        while (false !== ($file = readdir($handle))) {\n            if ($file != \".\" &amp;&amp; $file != \"..\" &amp;&amp; is_file($path . '\\\\' . $file)) {\n                foreach($toFound as $elt) {\n                    if (endWith($file, $elt) || empty($elt)) {\n                        $files[] = $path . '\\\\' . $file;\n                    }\n                }\n            } elseif ($file != \".\" &amp;&amp; $file != \"..\" &amp;&amp; is_dir($path . '\\\\' . $file)) {\n                $tmpFiles = foundFiles($path . '\\\\' . $file, $toFound);\n                foreach($tmpFiles as $tmpFile) {\n                    $files[] = $tmpFile;\n                }\n            }\n        }\n    }\n    return $files;\n}\n\nfunction writeToFile($file, $string) {\n    $handle = fopen($file, 'w');\n    fwrite($handle, $string);\n    fclose($handle);\n}\n\nfunction getAltPath($path) {\n    $pathAlt[] = ucfirst($path);\n    $pathAlt[] = str_replace('\/', '\\\\', ucfirst($path));\n    $pathAlt[] = lcfirst($path);\n    $pathAlt[] = str_replace('\/', '\\\\', lcfirst($path));\n    return $pathAlt;\n}\n\nfunction replaceWithNewPath($oldPath, $newPath, $filePath) {\n    $fileContent = file_get_contents($filePath);\n    $oldPathAlt = getAltPath($oldPath);\n    $newPathAlt = getAltPath($newPath);\n    $count = 0;\n    foreach($oldPathAlt as $key =&gt; $rpcPath) {\n        if (preg_match(\"#\" . str_replace('\\\\', '\\\\\\\\', $rpcPath) . \"#\", $fileContent)) {\n            if ($key == 0 || $key == 2) {\n                $fileContent = str_replace($rpcPath, $newPathAlt[0], $fileContent, $countRpc);\n                $count += $countRpc;\n            } else {\n                $fileContent = str_replace($rpcPath, $newPathAlt[1], $fileContent);\n                $count += $countRpc;\n            }\n        }\n    }\n    writeToFile($filePath, $fileContent);\n    return $count;\n}\n\nfunction deleteFolder($folderpath) {\n    if (is_dir($folderpath)) {\n        $dir_handle = opendir($folderpath);\n    }\n    if (!$dir_handle) {\n        return false;\n    }\n    while ($file = readdir( $dir_handle )) {\n        if ($file != '.' &amp;&amp; $file != '..') {\n            if (!is_dir($folderpath . '\/' . $file)) {\n                unlink($folderpath . '\/' . $file);\n            } else {\n                deleteFolder($folderpath . '\/' . $file);\n            }\n        }\n    }\n    closedir($dir_handle);\n    rmdir($folderpath);\n    return true;\n}\n\nfunction get_extension($file) {\n    if (is_file($file) &amp;&amp; preg_match('\/^[^\\x00]+\\.([a-z0-9]+)$\/i', $file, $matchResult)) {\n        return strtolower($matchResult[1]);\n    }\n}\n\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n\/\/ Start process\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n\n\/\/ Get wamp config\n$wampConfig = parse_ini_file($wampConfigPath, true);\nlogInfo(\"Parse wampmanager.conf\", isset($wampConfig['main']['installDir']));\n\n\/\/ Get oldPath and newPath\n$oldPath = $wampConfig['main']['installDir'];\n$newPath = str_replace('\\\\', '\/', getcwd());\nlogInfo(\"Paths\", !empty($oldPath) &amp;&amp; !empty($newPath), array(\n    \"oldPath\"   =&gt;  $oldPath,\n    \"newPath\"   =&gt;  $newPath,\n));\n\n\/\/ Get php versions list\n$phpArr = versionsAppList(\"bin\/php\", 3, array(\"php.exe\"));\nlogInfo(\"PHP versions\", !empty($phpArr), $phpArr, true, false);\n\n\/\/ Get apache versions list\n$apacheArr = versionsAppList(\"bin\/apache\", 6, array(\"bin\/apache.exe\", \"bin\/httpd.exe\"));\nlogInfo(\"Apache versions\", !empty($apacheArr), $apacheArr, true, false);\n\n\/\/ Get mysql versions list\n$mysqlArr = versionsAppList(\"bin\/mysql\", 5, array(\"bin\/mysqld.exe\", \"bin\/mysqld-nt.exe\"));\nlogInfo(\"MySQL versions\", !empty($mysqlArr), $mysqlArr, true, false);\n\n\/\/ Get mariadb versions list\n$mariadbArr = versionsAppList(\"bin\/mariadb\", 7, array(\"bin\/mysqld.exe\", \"bin\/mysqld-nt.exe\"));\nlogInfo(\"MariaDB versions\", !empty($mariadbArr), $mariadbArr, true, false, 'NOT FOUND');\n\n\/\/ Stop wampmanager\nlogInfo(\"Stop wampmanager\", true);\n$logsStopWampmanager = execCommand(\"TASKLIST \/FI \\\"IMAGENAME eq wampmanager.exe\\\" \/FO LIST | find \\\"wampmanager.exe\\\"\");\nif (!empty($logsStopWampmanager)) {\n    execCommand(\"TASKKILL \/IM wampmanager.exe \/F\");\n    execCommand(\"TIMEOUT \/T 3 \/NOBREAK\", false);\n} elseif ($verbose == 2) {\n    echoListener(\"\\nNot launched.\");\n}\n\n\/\/ Stop wampapache service\nlogInfo(\"Stop wampapache service\", true);\nexecCommand(\"NET STOP wampapache\");\n\n\/\/ Uninstall wampapache service\nlogInfo(\"Uninstall wampapache service\", true);\n$apachePath = end($apacheArr);\n$apachePath = $apachePath['path'] . '\\\\' . $apachePath['bin'];\n$apacheScript = $apachePath . \" -k uninstall -n wampapache\";\nexecCommand(array($apacheScript, \"SC delete wampapache\"));\n\n\/\/ Stop wampmysqld service\nlogInfo(\"Stop wampmysqld service\", true);\nexecCommand(\"NET STOP wampmysqld\");\n\n\/\/ Uninstall wampmysqld service\nlogInfo(\"Uninstall wampmysqld service\", true);\n$mysqlPath = end($mysqlArr);\n$mysqlPath = $mysqlPath['path'] . '\\\\' . $mysqlPath['bin'];\n$mysqlScript = $mysqlPath . \" --remove wampmysqld\";\nexecCommand(array($mysqlScript, \"SC delete wampmysqld\"));\n\n\/\/ Stop wampmariadb service\nlogInfo(\"Stop wampmariadb service\", true);\nexecCommand(\"NET STOP wampmariadb\");\n\n\/\/ Uninstall wampmariadb service\nif (!empty($mariadbArr)) {\n    logInfo(\"Uninstall wampmariadb service\", true);\n    $mariadbPath = end($mariadbArr);\n    $mariadbPath = $mariadbPath['path'] . '\\\\' . $mariadbPath['bin'];\n    $mariadbScript = $mariadbPath . \" --remove wampmariadb\";\n    execCommand(array($mariadbScript, \"SC delete wampmariadb\"));\n}\n\n\/\/ First launch ?\nif (!is_dir($rootBackupPath)) {\n    $backupsPath = $rootBackupPath . \"#original\";\n}\n\n\/\/ Create backups directory\nif (!is_dir($backupsPath)) {\n    mkdir($backupsPath, null, true);\n}\nlogInfo(\"Create backups directory\", is_dir($backupsPath));\n\n\/\/ Get files to scan\n$eltToScan = array(\n    'alias'     =&gt;  array(''),\n    'apache'    =&gt;  array('.ini', '.conf'),\n    'mysql'     =&gt;  array('my.ini'),\n    'php'       =&gt;  array('.ini'),\n);\n\n$pathsToScan = array();\nforeach ($eltToScan as $type =&gt; $elt) {\n    if ($type == 'alias') {\n        $pathsToScan[] = $type . ';' . getcwd() . '\\\\alias';\n    } elseif ($type == 'apache') {\n        $versionsAppPaths = versionsAppPaths($apacheArr, $type);\n        foreach ($versionsAppPaths as $value) {\n            $pathsToScan[] = $value;\n        }\n    } elseif ($type == 'mysql') {\n        $versionsAppPaths = versionsAppPaths($mysqlArr, $type);\n        foreach ($versionsAppPaths as $value) {\n            $pathsToScan[] = $value;\n        }\n    } elseif ($type == 'mariadb' &amp;&amp; !empty($mariadbArr)) {\n        $versionsAppPaths = versionsAppPaths($mariadbArr, $type);\n        foreach ($versionsAppPaths as $value) {\n            $pathsToScan[] = $value;\n        }\n    } elseif ($type == 'php') {\n        $versionsAppPaths = versionsAppPaths($phpArr, $type);\n        foreach ($versionsAppPaths as $value) {\n            $pathsToScan[] = $value;\n        }\n    }\n}\n\n$filesToScan[] = $wampConfigPath;\n$filesToScan[] = $wampTplPath;\n$filesToScan[] = $wampIniPath;\nforeach ($pathsToScan as $elt) {\n    $path = explode(\";\", $elt);\n    $type = $path[0];\n    $path = $path[1];\n    $foundFiles = foundFiles($path, $eltToScan[$type]);\n    foreach ($foundFiles as $value) {\n        $filesToScan[] = $value;\n    }\n}\n\nlogInfo(\"Files to scan\", count($filesToScan) &gt; 2, $filesToScan, false);\n\n\/\/ Backup files before edit\n$backupFiles = array();\nforeach ($filesToScan as $file) {\n    $infofile = pathinfo($file);\n    $backupFileFolder = $backupsPath . str_replace(str_replace('\/', '\\\\', $newPath), '', $infofile['dirname']);\n    $backupFile = $backupFileFolder . \"\\\\\" . $infofile['basename'];\n    if (!is_dir($backupFileFolder)) {\n        mkdir($backupFileFolder, null, true);\n    }\n    if (copy($file, $backupFile)) {\n        $backupFiles[] = $backupFile;\n    }\n}\n\nlogInfo(\"Backup files\", count($backupFiles) &gt; 2, $backupFiles, false);\n\n\/\/ Replace old path in files\n$rpcFiles = array();\nforeach ($filesToScan as $file) {\n    $echoStr = $file;\n    $dots = \"\";\n    for ($i=strlen($echoStr); $i&lt;=90; $i++) $dots .= \".\";     $countRpc = replaceWithNewPath($oldPath, $newPath, $file);     $rpcFiles[] = $echoStr . \" \" . $dots . \" \" . ($countRpc &gt; 0 ? $countRpc . \" found\" : \"none\");\n}\n\nlogInfo(\"Replace old path in files\", count($rpcFiles) &gt; 2, $rpcFiles, false);\n\n\/\/ Purge logs\nif ($purgeWampLogs) {\n    $purgeLogs = array();\n    if (is_dir($wampLogsPath)) {\n        $dir_handle = opendir($wampLogsPath);\n        if ($dir_handle) {\n            while ($file = readdir( $dir_handle )) {\n                $ext = get_extension($wampLogsPath . $file);\n                if ($file != '.' &amp;&amp; $file != '..' &amp;&amp; $ext == 'log') {\n                    $purgeLogs[] = $wampLogsPath . $file;\n                    @unlink($wampLogsPath . $file);\n                }\n            }\n            closedir($dir_handle);\n        }\n    }\n    logInfo(\"Purge logs\", true, $purgeLogs, false);\n}\n\n\/\/ Install wampmysqld service\n$mysqlVersion = $wampConfig['mysql']['mysqlVersion'];\n$mysqlVersion = str_replace('\"', '', $mysqlVersion);\n$mysqlPath = $mysqlArr[$mysqlVersion]['path'] . '\\\\' . $mysqlArr[$mysqlVersion]['bin'];\n$mysqlInstallParams = $wampConfig['mysql']['mysqlServiceInstallParams'];\n$mysqlInstallParams = str_replace('\"', '', $mysqlInstallParams);\n$mysqlService = $mysqlPath . \" \" . $mysqlInstallParams;\n\nlogInfo(\"Install wampmysqld service\", true);\nexecCommand($mysqlService);\nexecCommand(\"TIMEOUT \/T 1 \/NOBREAK\", false);\nexecCommand(\"NET START wampmysqld\");\n\nif (!empty($mariadbArr)) {\n    \/\/ Install wampmariadb service\n    $mariadbVersion = $wampConfig['mariadb']['mariadbVersion'];\n    $mariadbVersion = str_replace('\"', '', $mariadbVersion);\n    $mariadbPath = $mariadbArr[$mariadbVersion]['path'] . '\\\\' . $mariadbArr[$mariadbVersion]['bin'];\n    $mariadbInstallParams = $wampConfig['mariadb']['mariadbServiceInstallParams'];\n    $mariadbInstallParams = str_replace('\"', '', $mariadbInstallParams);\n    $mariadbService = $mariadbPath . \" \" . $mariadbInstallParams;\n\n    logInfo(\"Install wampmariadb service\", true);\n    execCommand($mariadbService);\n    execCommand(\"TIMEOUT \/T 1 \/NOBREAK\", false);\n    execCommand(\"NET START wampmariadb\");\n}\n\n\/\/ Install wampapache service\n$apacheVersion = $wampConfig['apache']['apacheVersion'];\n$apacheVersion = str_replace('\"', '', $apacheVersion);\n$apachePath = $apacheArr[$apacheVersion]['path'] . '\\\\' . $apacheArr[$apacheVersion]['bin'];\n$apacheInstallParams = $wampConfig['apache']['apacheServiceInstallParams'];\n$apacheInstallParams = str_replace('\"', '', $apacheInstallParams);\n$apacheService = $apachePath . \" \" . $apacheInstallParams;\n\nlogInfo(\"Install wampapache service\", true);\nexecCommand($apacheService);\nexecCommand(\"TIMEOUT \/T 1 \/NOBREAK\", false);\nexecCommand(\"NET START wampapache\");\n\n\/\/ Delete old backups\nif ($maxBackups &gt; 0) {\n    $listBackups = array();\n    if ($handle = opendir($rootBackupPath)) {\n        while (false !== ($file = readdir($handle))) {\n            if ($file != \".\" &amp;&amp; $file != \"..\" &amp;&amp; is_dir($rootBackupPath . $file) &amp;&amp; is_numeric($file)) {\n                $listBackups[] = $rootBackupPath . $file;\n            }\n        }\n    }\n    if (!empty($listBackups) &amp;&amp; count($listBackups) &gt; $maxBackups) {\n        sort($listBackups);\n        $toDelete = count($listBackups) - $maxBackups;\n        $listBackupsDelete = array();\n        for ($i=0; $i&lt;$toDelete; $i++) {             $listBackupsDelete[] = $listBackups[$i];             deleteFolder($listBackups[$i]);         }         logInfo(\"Delete old backups\", count($listBackupsDelete) &gt; 0, $listBackupsDelete, false);\n    }\n}\n\n\/\/ Now ready to use\nechoListener(\"\\n\\n\");\nechoListener(\"Operation completed successfully!\\nWamp is now ready to use!\");\nechoListener(\"\\n\\n\");\nif (!$autoLaunch) {\n    echoListener(\"Press any key to launch Wamp...\");\n    `pause`;\n}\n\n\/\/ Launch wampmanager\nechoListener(\"\\n\\nLaunch wampmanager\\n\\n\");\n`ECHO set args = WScript.Arguments &gt;%wampLauncher%`;\n`ECHO num = args.Count &gt;&gt;%wampLauncher%`;\n`ECHO. &gt;&gt;%wampLauncher%`;\n`ECHO if num = 0 then &gt;&gt;%wampLauncher%`;\n`ECHO   WScript.Quit 1 &gt;&gt;%wampLauncher%`;\n`ECHO end if &gt;&gt;%wampLauncher%`;\n`ECHO. &gt;&gt;%wampLauncher%`;\n`ECHO sargs = \"\" &gt;&gt;%wampLauncher%`;\n`ECHO if num ^&gt; 1 then &gt;&gt;%wampLauncher%`;\n`ECHO   sargs = \" \" &gt;&gt;%wampLauncher%`;\n`ECHO   for k = 1 to num - 1 &gt;&gt;%wampLauncher%`;\n`ECHO       anArg = args.Item(k) &gt;&gt;%wampLauncher%`;\n`ECHO       sargs = sargs ^&amp; anArg ^&amp; \" \" &gt;&gt;%wampLauncher%`;\n`ECHO   next &gt;&gt;%wampLauncher%`;\n`ECHO end if &gt;&gt;%wampLauncher%`;\n`ECHO. &gt;&gt;%wampLauncher%`;\n`ECHO Set WshShell = WScript.CreateObject(\"WScript.Shell\") &gt;&gt;%wampLauncher%`;\n`ECHO. &gt;&gt;%wampLauncher%`;\n`ECHO WshShell.Run \"\"\"\" ^&amp; WScript.Arguments(0) ^&amp; \"\"\"\" ^&amp; sargs, 0, False &gt;&gt;%wampLauncher%`;\n\n`ECHO @ECHO OFF&gt;%wampLauncherScript%`;\n`ECHO SETLOCAL EnableDelayedExpansion&gt;&gt;%wampLauncherScript%`;\n`ECHO.&gt;&gt;%wampLauncherScript%`;\n`ECHO start \/w %wampmanagerDaemon%&gt;&gt;%wampLauncherScript%`;\n`ECHO.&gt;&gt;%wampLauncherScript%`;\n`ECHO NET STOP wampapache&gt;&gt;%wampLauncherScript%`;\n`ECHO $apacheScript&gt;&gt;%wampLauncherScript%`;\n`ECHO TIMEOUT \/T 4 \/NOBREAK&gt;&gt;%wampLauncherScript%`;\n`ECHO SC delete wampapache&gt;&gt;%wampLauncherScript%`;\n`ECHO.&gt;&gt;%wampLauncherScript%`;\n`ECHO NET STOP wampmysqld&gt;&gt;%wampLauncherScript%`;\n`ECHO $mysqlScript&gt;&gt;%wampLauncherScript%`;\n`ECHO TIMEOUT \/T 4 \/NOBREAK&gt;&gt;%wampLauncherScript%`;\n`ECHO SC delete wampmysqld&gt;&gt;%wampLauncherScript%`;\n`ECHO.&gt;&gt;%wampLauncherScript%`;\n`ECHO ENDLOCAL&gt;&gt;%wampLauncherScript%`;\n\n`wscript.exe %wampLauncher% %wampLauncherScript%`;\n\nif ($enableLogs) file_put_contents($logsPath, \"@@@\\n@@@ END WAMP-PORTABLE \" . date('YmdHis') . \"\\n@@@\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\", FILE_APPEND);\n\n?&gt;<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Copier-coller le contenu ci-apr\u00e8s dans un fichier que vous nommerez wamp-portable.bat @ECHO OFF SETLOCAL EnableDelayedExpansion :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: :: :: Wamp Portable :: :: :: :: A DOS Batch script to make WampServer portable. :: :: :: :: Copyright (C) 2012-2013 Cr@zy &lt;webmaster@crazyws.fr&gt; :: :: :: :: Wamp-Portable is free software; you can redistribute it and\/or &hellip; <a href=\"http:\/\/les-fougs.com\/wordpress\/2013\/11\/11\/wamp-portable-bat\/\" class=\"more-link\">Continuer la lecture<span class=\"screen-reader-text\"> de &laquo;&nbsp;wamp-portable.bat&nbsp;&raquo;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[31],"tags":[],"_links":{"self":[{"href":"http:\/\/les-fougs.com\/wordpress\/wp-json\/wp\/v2\/posts\/684"}],"collection":[{"href":"http:\/\/les-fougs.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/les-fougs.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/les-fougs.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/les-fougs.com\/wordpress\/wp-json\/wp\/v2\/comments?post=684"}],"version-history":[{"count":0,"href":"http:\/\/les-fougs.com\/wordpress\/wp-json\/wp\/v2\/posts\/684\/revisions"}],"wp:attachment":[{"href":"http:\/\/les-fougs.com\/wordpress\/wp-json\/wp\/v2\/media?parent=684"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/les-fougs.com\/wordpress\/wp-json\/wp\/v2\/categories?post=684"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/les-fougs.com\/wordpress\/wp-json\/wp\/v2\/tags?post=684"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}