请问,怎么写个程序,自动运行cmd里的一条命令
请教,如何写个程序,自动运行cmd里的一条命令?
我用自己的笔记本建立一个wifi热点
每次都要打开cmd,并且输入 netsh wlan start hostednetwork
每次想建立wifi热点总是要重复以上步骤
能不能写个程序能直接打开cmd并且执行上面一句命令的?
------解决方案--------------------
可参考以下API
我用自己的笔记本建立一个wifi热点
每次都要打开cmd,并且输入 netsh wlan start hostednetwork
每次想建立wifi热点总是要重复以上步骤
能不能写个程序能直接打开cmd并且执行上面一句命令的?
------解决方案--------------------
可参考以下API
- C/C++ code
HINSTANCE ShellExecute( HWND hwnd, LPCTSTR lpOperation, LPCTSTR lpFile, LPCTSTR lpParameters, LPCTSTR lpDirectory, INT nShowCmd ); BOOL ShellExecuteEx( LPSHELLEXECUTEINFO lpExecInfo ); UINT WINAPI WinExec( __in LPCSTR lpCmdLine, __in UINT uCmdShow ); BOOL WINAPI CreateProcess( __in LPCTSTR lpApplicationName, __in_out LPTSTR lpCommandLine, __in LPSECURITY_ATTRIBUTES lpProcessAttributes, __in LPSECURITY_ATTRIBUTES lpThreadAttributes, __in BOOL bInheritHandles, __in DWORD dwCreationFlags, __in LPVOID lpEnvironment, __in LPCTSTR lpCurrentDirectory, __in LPSTARTUPINFO lpStartupInfo, __out LPPROCESS_INFORMATION lpProcessInformation );