このページの2つのバージョン間の差分を表示します。
| 両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン | ||
|
xampp:switch [2020/11/21 23:24] y2sunlight [XAMPPのバージョン切り替え] |
xampp:switch [2020/11/22 01:25] (現在) y2sunlight [MariaDBのサービス登録] |
||
|---|---|---|---|
| 行 1: | 行 1: | ||
| ====== XAMPP 複数バージョンの利用 ====== | ====== XAMPP 複数バージョンの利用 ====== | ||
| - | --- // | + | --- // |
| [[xampp: | [[xampp: | ||
| 行 290: | 行 290: | ||
| </ | </ | ||
| - | mariaDBの起動/ | + | MariaDBの起動/ |
| <code dos> | <code dos> | ||
| - | net start mariaDB10 | + | net start MariaDB10 |
| - | net stop mariaDB10 | + | net stop MariaDB10 |
| </ | </ | ||
| - | また、mariaDBのサービス登録を削除するには以下のコマンドを実行します。 | + | また、MariaDBのサービス登録を削除するには以下のコマンドを実行します。 |
| <code dos> | <code dos> | ||
| - | mysqld --remove "mariaDB10" | + | mysqld --remove "MariaDB10" |
| </ | </ | ||
| 行 311: | 行 311: | ||
| \\ | \\ | ||
| - | ===== XAMPPのバージョン切り替え ===== | + | ===== バージョン切り替えの手順 |
| - | 最終的に、XAMPPのバージョン切り替えは以下の手順で行うことができます。 | + | 最終的に、XAMPPのバージョン切り替えは以下の手順で行うことができます。'' |
| - '' | - '' | ||
| * Apacheを停止します。 | * Apacheを停止します。 | ||
| * Mariaを停止します。\\ \\ | * Mariaを停止します。\\ \\ | ||
| - | - XAMPPのカレントリンクの在るフォルダに移動します: | ||
| - | * '' | ||
| - xampswを使ってXAMPPのバージョン切り替えます: | - xampswを使ってXAMPPのバージョン切り替えます: | ||
| - | * '' | + | * '' |
| - '' | - '' | ||
| * Apacheを開始します。 | * Apacheを開始します。 | ||
| - | * Mariaを開始します。\\ \\ | + | * Mariaを開始します。 |
| + | |||
| + | これらの手順を自動的に行うBATファイルを以下に示します: | ||
| + | |||
| + | === 最終版の zampsw.bat === | ||
| + | |||
| + | {{fa> | ||
| + | <code winbatch zampsw.bat> | ||
| + | @echo off | ||
| + | setlocal EnableDelayedExpansion | ||
| + | |||
| + | rem ---------------------------------------------- | ||
| + | rem 設定 | ||
| + | rem ---------------------------------------------- | ||
| + | |||
| + | rem サービス名を設定 | ||
| + | set apache=Apache2.4 | ||
| + | set mysql=MariaDB10 | ||
| + | |||
| + | rem XAMPPのバージョンを設定 | ||
| + | set xamp_ver=%1 | ||
| + | set xamp_link=xampp | ||
| + | set xamp_target=%xamp_link%%xamp_ver% | ||
| + | |||
| + | rem エラーチェック | ||
| + | echo; | ||
| + | if "" | ||
| + | echo 使い方: %0 [XAMPPのバージョン番号] | ||
| + | echo 実行例: %0 1.2.3 | ||
| + | goto END | ||
| + | ) | ||
| + | |||
| + | whoami /priv | find " | ||
| + | if !ERRORLEVEL! neq 0 ( | ||
| + | echo Error: 管理者権限で実行して下さい | ||
| + | goto END | ||
| + | ) | ||
| + | |||
| + | if not exist %xamp_target% ( | ||
| + | echo Error: " | ||
| + | goto END | ||
| + | ) | ||
| + | |||
| + | rem ---------------------------------------------- | ||
| + | rem サービスの停止 | ||
| + | rem ---------------------------------------------- | ||
| + | |||
| + | if not "" | ||
| + | sc query " | ||
| + | if !ERRORLEVEL! equ 0 ( | ||
| + | echo stop " | ||
| + | net stop " | ||
| + | ) | ||
| + | ) | ||
| + | |||
| + | if not "" | ||
| + | sc query " | ||
| + | if !ERRORLEVEL! equ 0 ( | ||
| + | echo stop " | ||
| + | net stop " | ||
| + | ) | ||
| + | ) | ||
| + | |||
| + | rem ---------------------------------------------- | ||
| + | rem XAMPPリンクの切り替え | ||
| + | rem ---------------------------------------------- | ||
| + | |||
| + | if exist %xamp_link% ( | ||
| + | echo remove %xamp_link% | ||
| + | rmdir %xamp_link% | ||
| + | ) | ||
| + | |||
| + | echo link %xamp_target% to %xamp_link% | ||
| + | mklink /D %xamp_link% | ||
| + | echo; | ||
| + | |||
| + | rem ---------------------------------------------- | ||
| + | rem サービスの開始 | ||
| + | rem ---------------------------------------------- | ||
| + | |||
| + | if not "" | ||
| + | sc query " | ||
| + | if !ERRORLEVEL! neq 0 ( | ||
| + | echo start " | ||
| + | net start " | ||
| + | ) | ||
| + | ) | ||
| + | |||
| + | if not "" | ||
| + | sc query " | ||
| + | if !ERRORLEVEL! neq 0 ( | ||
| + | echo start " | ||
| + | net start " | ||
| + | ) | ||
| + | ) | ||
| + | goto END | ||
| + | |||
| + | :END | ||
| + | rem ---------------------------------------------- | ||
| + | rem 現在のXAMPP情報の表示 | ||
| + | rem ---------------------------------------------- | ||
| + | |||
| + | echo; | ||
| + | echo 【 現在のXAMPP情報 】 | ||
| + | echo; | ||
| + | dir %xamp_link%*|findstr " | ||
| + | </ | ||
| + | |||
| + | このBATファイルを使用すれば、単に '' | ||
| + | |||
| + | サービス名を指定するには以下の部分を変更して下さい。この部分をコメントアウトするか削除すればサービスの停止/ | ||
| + | |||
| + | <code winbatch> | ||
| + | rem サービス名を設定 | ||
| + | set apache=Apache2.4 | ||
| + | set mysql=MariaDB10 | ||
| + | </ | ||
| + | |||
| + | また、このバッチファイルにPATHを通してどこからでも起動できるようにした場合は、以下のように '' | ||
| + | |||
| + | <code winbatch> | ||
| + | set xamp_link=D: | ||
| + | </ | ||
| + | |||
| \\ | \\ | ||