我尝试执行命令到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/