OSDN Git Service

Execute the "pause" command to prevent the error message from disappearing if the...
authorsdottaka <sdottaka@users.sourceforge.net>
Thu, 17 Aug 2023 01:11:45 +0000 (10:11 +0900)
committersdottaka <sdottaka@users.sourceforge.net>
Thu, 17 Aug 2023 01:11:45 +0000 (10:11 +0900)
Src/PropShell.cpp

index 358320c..b16cc45 100644 (file)
@@ -125,9 +125,9 @@ static bool RegisterWinMergeContextMenu(bool unregister)
        String progpath = env::GetProgPath();
        String packagepath = paths::ConcatPath(progpath, _T("WinMergeContextMenuPackage.msix"));
        if (!unregister)
-               cmd = strutils::format(_T("powershell -c \"Add-AppxPackage '%s' -ExternalLocation '%s'\""), packagepath, progpath);
+               cmd = strutils::format(_T("powershell -c \"Add-AppxPackage '%s' -ExternalLocation '%s'; if (!$?) { pause }\""), packagepath, progpath);
        else
-               cmd = _T("powershell -c \"Get-AppxPackage -name WinMerge | Remove-AppxPackage\"");
+               cmd = _T("powershell -c \"Get-AppxPackage -name WinMerge | Remove-AppxPackage; if (!$?) { pause }\"");
 
        STARTUPINFO stInfo = { sizeof(STARTUPINFO) };
        stInfo.dwFlags = STARTF_USESHOWWINDOW;