I am trying to perform file management within the PLC. Currently, NT_StartProcess works as follows, but I will not have any feedback after the process has been spawned. Is there a way to check the contents of a directory from the PLC? Is there any way to get feedback from NT_StartProcess?
// File Locations
sTargetFilePath := 'C:\LocalHistory\test.job';
sTargetDirectory := 'C:\\CustomerDir';
// Build Command String
sCommand := '/C '; // Special command indicating command string input
sCommand := CONCAT(sCommand, 'move '); // Add move command
sCommand := CONCAT(sCommand, sTargetFilePath); // Add target file
sCommand := CONCAT(sCommand, ' '); // Required space for command
sCommand := CONCAT(sCommand, sTargetDirectory); // Add target location
// Output -> ‘/C move C:\NET-DRIVE\NewOrders\Original.xml 'C:\NET-DRIVE\OldOrders’
Process(
NETID := '', // Local System
PATHSTR := 'C:\Windows\System32\cmd.exe', // Path to local cmd executable
COMNDLINE := sCommand, // Comnmand to be executed
ERR => bError, // Error Output
ERRID => iErrorId // Error Id Output
);
// Trigger Command
IF bTrigger THEN
bTrigger := FALSE;
Process(START:=TRUE);
Process(START:=FALSE);
END_IF