#include <windows.h>
#include <tchar.h>
#define BUF_SIZE 1024
int APIENTRY WinMain(
HINSTANCE hInstance, // handle to current instance
HINSTANCE hPrevInstance, // handle to previous instance
LPSTR lpCmdLine, // command line
int nCmdShow // show state
)
{
const TCHAR TITLE[] = _T("get_run.exe");
TCHAR path[BUF_SIZE], temp[BUF_SIZE];
TCHAR* name;
::GetModuleFileName(NULL, temp, BUF_SIZE-1);
::GetFullPathName(temp, BUF_SIZE, path, &name);
// get path of module
--name; // set pointer into place of '\\'
*name = _T('\0'); // replace '\\' by '\0'
++name; // set pointer back
// set path of module as current
::SetCurrentDirectory(path);
// ::MessageBox(NULL, path, TITLE, MB_OK);
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
si.dwFlags = STARTF_USESHOWWINDOW; // use wShowWindow
si.wShowWindow = SW_HIDE; // hide window
ZeroMemory( &pi, sizeof(pi) );
// Start the child process.
if( FALSE == CreateProcess(
NULL, // No module name (use command line).
// Command line
// _T("ftp -s:get_run.ftp"),
_T("get_run.bat"),
NULL, // Process handle not inheritable.
NULL, // Thread handle not inheritable.
FALSE, // Set handle inheritance to FALSE.
CREATE_NEW_CONSOLE,// No creation flags.
NULL, // Use parent's environment block.
NULL, // Use parent's starting directory.
&si, // Pointer to STARTUPINFO structure.
&pi ) // Pointer to PROCESS_INFORMATION structure.
)
::MessageBox(NULL, _T("ERROR"), TITLE, MB_OK);
// Wait until child process exits.
// WaitForSingleObject( pi.hProcess, INFINITE );
// Close process and thread handles.
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
//ExitProcess(0);
return 0;
}
get_run.rar_child
版权申诉
87 浏览量
2022-09-24
02:45:28
上传
评论
收藏 8KB RAR 举报
小波思基
- 粉丝: 72
- 资源: 1万+
最新资源
- 基于Python和PyTorch框架完成的一个手写数字识别实验源码(带MINIST手写数字数据集)+详细注释(高分项目)
- 基于Matlab在MNIST数据集上利用CNN完成手写体数字识别任务,并实现单层CNN反向传播算法+源代码+文档说明(高分项目)
- NVIDIA驱动、CUDA和Pytorch及其依赖
- html动态爱心代码一(附源码)
- c40539bc-071a-486c-9d52-9d0c18d62dac 4.html
- 基于物理的非视域成像(NLOS)算法,利用了nerf+python源码+文档说明
- yuluer知更鸟.7z(1).001
- python课程设计-基于tensorflow实现的图文生成程序,数据集flickr30k-images+源代码+文档说明+截图
- python作业-基于Flickr30k数据集实现图像文本跨模态搜索python源码+数据集+测试界面+项目说明(高分课程设计)
- 基于Qt实现医院信息管理系统c++源码+文档说明+数据库(期末大作业)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈