I thought I would post up a simple example in a TI process to generate a batch file, execute it, and kill it.
The process creates the file usernames.bat in the folder C:\BV. After that, it executes the bat file and kills it again. As a result, the username in Windows is appended to the file C:\TM1\usernames.txt
Steps to reproduce:
Create a new process
In the Prolog tab:
Code: Select all
# 0. preliminary
vTempFileName='C:\BV\username.bat';
DatasourceASCIIQuoteCharacter='';
# 1. create the temporary bat file
ASCIIOUTPUT(vTempFileName,'cd "C:\TM1"');
ASCIIOUTPUT(vTempFileName,'echo %username% >> usernames.txt');
Code: Select all
# 2. execute the file
EXECUTECOMMAND(vTempFileName,1);
# 3. kill the temporary bat file again
ASCIIDELETE(vTempFileName);