There is a pretty easy way of generating a file in QlikView and that is to load the rows of text that you want in that file into a table and then use the Store command to write that table to a text file. If there is only one column in the table, then no separators will be written.
One "gotcha" about writing text files like this is that the field name will always be written. This is easy to get around in the case of a batch file because you can name the field to some valid batch syntax - like "@echo off" or "REM Start of Batch File" - and that will be fine.
Here is an example to generate a batch file that will move all of the text files from one location to another (pretty lame example!):
'REM This is a batch file test' As [@echo off]
For Each vFile in FileList('c:\temp\Folder1\*.txt')
'MOVE $(vFile) C:\Temp\Folder2' As [@echo off]
Store BatFile into c:\temp\test.bat (txt);
Drop Table BatFile;
Now, the final execute will only work in QlikView if you have the "Can Execute External Programs" turned on in the Settings tab inside the Script Editor. If you have publisher, you can have the QlikView task generate the .bat file and then have Publisher execute it.
Stephen Redmond is author of QlikView Server and Publisher and the QlikView for Developer's Cookbook
He is CTO of CapricornVentis a QlikView Elite Partner. We are always looking for the right people to join our team.
Follow me on Twitter: @stephencredmond