delphi ShellExecute的用法
ShellExecute(Application.Handle, nil, PChar(FileBatPath), nil, nil, SW_SHOWNORMAL);
ShellExecute(Application.Handle, 'open', PChar(FileBatPath), nil, nil, SW_SHOWNORMAL);
其中FileBatPath 是 .bat的目录。
运行时 能打开.bat文件,窗体一闪而过! 但是不执行.bat里面的动作!!!
如果我手动打开.bat文件 执行后会弹出成功/失败的窗口, 用ShellExecute后 没有弹出结果框。
并且能确定里面的动作没有执行。。。。这个啥原因?
[解决办法]
直接执行
ShellExecute(Application.Handle, 'open', PChar('winpop'), 'add 000001@youxiang.com /createuser 000001', nil, SW_SHOWNORMAL);
倒数第二个参数,写上执行的winpop的路径。
[解决办法]
用这个应该可行:
WinExec(PChar(FileBatPath), SW_HIDE);