提问者:小点点

为什么命令不执行?


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

共1个答案

匿名用户

这个管用

ShellExecute(NULL, L"open", L"cmd", L"/c notepad.exe", NULL, SW_NORMAL);

不要使用强制转换来移除编译器错误。 错误告诉您使用了错误的类型,请使用正确的类型。