c++ - 为什么命令不执行?

标签 c++

我尝试执行命令到CMD,但不起作用
包括:

#include <Windows.h>
#include <processthreadsapi.h>
#include <shellapi.h>
#include <stdio.h>
#include <iostream>
我如何尝试打开记事本:
ShellExecute(NULL, (LPCWSTR)"open", (LPCWSTR)"cmd", (LPCWSTR)"/c notepad.exe", NULL, SW_NORMAL);

最佳答案

这有效

ShellExecute(NULL, L"open", L"cmd", L"/c notepad.exe", NULL, SW_NORMAL);
不要使用强制类型转换来消除编译器错误。错误告诉您使用的类型错误,请改用正确的类型。

关于c++ - 为什么命令不执行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63088800/

相关文章:

c++ - 如何忽略来自 _CrtDumpMemoryLeaks 的误报内存泄漏?

c++ - 将 unique_ptr<Derived> 转换为 unique_ptr<Base>

c++ - 运行 cmake 后出现 undefined reference 错误

c++ - 通过头文件函数将二叉搜索树中遍历的数据加载到Vector中

c++ - ffmpeg - 比较 2 个 AVFrames 数据

c++ - GLFW/glfw3.h 包含失败

c++ - 在QT(C++)中实现简单鼓机的技巧

c++ - cout流的限制?

c++ - Gcc:强制编译器默认使用 unsigned char

c++ - 如何使用 UTF-8 字符序列在 C++ 中初始化 const char* 和/或 const std::string?