cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
hh1234
Level 5

WriteLine to Server Share

Hi, I have this code:

function OnFirstUIBefore()
number nResult, nLevel, nSize, nSetupType, nvFileHandle;
string szTitle, szMsg, szOpt1, szOpt2, szLicenseFile;
string szName, szCompany, szTargetPath, szDir, szFeatures, szLine, szString, CPU;
BOOL bLicenseAccepted;

begin
OpenFileMode (FILE_MODE_APPEND);
CreateFile (nvFileHandle, "\\\\Server01\\Logs$\\test", "CreateFileISM.txt");
// this works. The file called CreateFileISM.txt does get created on the server.

CPU=(LaunchApplication("C:\\Windows\\System32\\cmd.exe", "/c wmic cpu get Manufacturer", "", SW_HIDE, INFINITE, LAAW_OPTION_USE_SHELLEXECUTE));
WriteLine(nvFileHandle,"\\\\Server01\\Logs$\\test\\CreateFileISM.txt", CPU);

end;

// The WriteLine fails and I have not gotten it to work yet. Where is my syntax in error?

Thanks.
Labels (1)
0 Kudos
(1) Reply
Roman1
Level 9

Hi,

It is enough to call LaunchApplication:

//=============================================
LaunchApplication("C:\\Windows\\System32\\cmd.exe", "/c wmic cpu get Manufacturer >\"\\\\Server01\\Logs$\\test\\cpu.txt\"", "", SW_HIDE, INFINITE, LAAW_OPTION_USE_SHELLEXECUTE);
//=============================================

cpi.txt gets the Manufacturer.
0 Kudos