diff --git a/include/boost/process/detail/windows/basic_cmd.hpp b/include/boost/process/detail/windows/basic_cmd.hpp index 53ea9931d..5c51f175a 100644 --- a/include/boost/process/detail/windows/basic_cmd.hpp +++ b/include/boost/process/detail/windows/basic_cmd.hpp @@ -159,7 +159,10 @@ struct exe_cmd_init : handler_base_ext return exe_cmd_init(std::move(sh), std::move(args_)); } - static std:: string get_shell(char) {return shell(). string(codecvt()); } + static std:: string get_shell(char) { + std::wstring_convert, wchar_t> converter; + return converter.to_bytes(shell().wstring(codecvt())); + } static std::wstring get_shell(wchar_t) {return shell().wstring(codecvt());} static exe_cmd_init cmd_shell(string_type&& cmd) diff --git a/include/boost/process/detail/windows/shell_path.hpp b/include/boost/process/detail/windows/shell_path.hpp index bb150c944..a27ec20d9 100644 --- a/include/boost/process/detail/windows/shell_path.hpp +++ b/include/boost/process/detail/windows/shell_path.hpp @@ -26,7 +26,7 @@ inline boost::process::filesystem::path shell_path() throw_last_error("GetSystemDirectory() failed"); boost::process::filesystem::path p = sysdir; - return p / "cmd.exe"; + return p += L"\\cmd.exe"; } inline boost::process::filesystem::path shell_path(std::error_code &ec) noexcept @@ -43,7 +43,7 @@ inline boost::process::filesystem::path shell_path(std::error_code &ec) noexcept { ec.clear(); p = sysdir; - p /= "cmd.exe"; + p += L"\\cmd.exe"; } return p; }