English 中文(简体)
B. 没有开始指挥的Batch档案
原标题:Batch file not working with start command

我需要从C++中管理一个批量档案,该档案可执行“exe”申请,而“exe”是一个称为“倾销”的免费方案,该节目将监测ed到文字档案中。 只要批量档案不使用开端指挥,我就使用制造装置。

"DumpEDID.exe" > "edid.txt" // this works
start /wait /d "DumpEDID.exe" > "edid.txt" // this doesn t

然而,我想利用“wait”指挥系统,这是一个问题。 这是否只是申请本身的问题? 我的作战档案管理守则如下:

std::ofstream fs;
fs.open(DUMP_EDID_BATCH_FILE_PATH);
fs << """ << DUMP_EDID_EXE_PATH << "" > "" << DUMP_EDID_TXT_FILE_PATH << """;
fs.close();

STARTUPINFOA si;
PROCESS_INFORMATION pi;

ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );

std::string str = (std::string)"/c " + """ + DUMP_EDID_BATCH_FILE_PATH + """;
char * cmdLine = new char[str.size() + 1];
strncpy(cmdLine,str.c_str(), str.size());
cmdLine[str.size()] =   ;

if( !CreateProcessA( "c:\Windows\system32\cmd.exe", 
    cmdLine, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi) ) 
{
    delete[] cmdLine;
    DWORD errCode = GetLastError();
    g_log.Info(_T("CreateProcess failed - error code %d"), errCode);
    return errCode;
}

delete[] cmdLine;

WaitForSingleObject( pi.hProcess, INFINITE );

CloseHandle( pi.hProcess );
CloseHandle( pi.hThread ); 

感谢。

EDIT——我刚刚尝试直接从指挥线上管理批量档案,我注意到一些奇怪之处,批量档案的内容是

开始/放弃/d“D:......dumpedid”和“D:...edid.txt”

但是,当我掌握批量档案时显示的指挥是

开始/wait /d “D:......dumpedid” 1>”D:...edid.txt”

第1号通知;第1号之前的编号和额外空间

最佳回答

The title option is the first quoted argument, so if you have a quoted cmd you need also a title option.
start "myTitle" /start "cmd"

如果你试图将产出重新导向,那么你需要从中解脱,因为normal后向方向调整的产出。 指挥不是开始指挥!

start “" /wait /d “DumpEDID.exe”^> “edid.txt”

问题回答

暂无回答




相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?