diff --git a/src/common/common.cpp b/src/common/common.cpp index 73b3cef1896..7be915b19c8 100644 --- a/src/common/common.cpp +++ b/src/common/common.cpp @@ -248,7 +248,7 @@ bool run_elevated(const std::wstring& file, const std::wstring& params) { } bool run_non_elevated(const std::wstring& file, const std::wstring& params) { - auto executable_args = file; + auto executable_args = L"\"" + file + L"\""; if (!params.empty()) { executable_args += L" " + params; } @@ -311,7 +311,7 @@ bool run_non_elevated(const std::wstring& file, const std::wstring& params) { } bool run_same_elevation(const std::wstring& file, const std::wstring& params) { - auto executable_args = file; + auto executable_args = L"\"" + file + L"\""; if (!params.empty()) { executable_args += L" " + params; } diff --git a/src/runner/restart_elevated.cpp b/src/runner/restart_elevated.cpp index 410c9884e04..3527fc89bc8 100644 --- a/src/runner/restart_elevated.cpp +++ b/src/runner/restart_elevated.cpp @@ -47,5 +47,5 @@ bool restart_same_elevation() constexpr DWORD exe_path_size = 0xFFFF; auto exe_path = std::make_unique(exe_path_size); GetModuleFileNameW(nullptr, exe_path.get(), exe_path_size); - return run_same_elevation(exe_path.get(), {}); + return run_same_elevation(exe_path.get(), L"--dont-elevate"); }