as deeper info to anyone interested:
it works, but in this way you can't pass parameters to the bat file.
Also it seems to execute it in a directory that could be different from the one in which the script is: I had some strange behaviour, but I had cmd.exe open and I didn't pursue it further since I changed my approach, maybe it was only a glitch or my fault.
anyway, if for someone these are issues (like for me) i recommend to create and execute the bat file from inside the jsl:
riga1 = "@echo off";
riga2 = "\!Ncd C:\Users\JRR\Documents\sandbox\v2.2_bat";
riga3 = "\!Ndir>urano.txt";
Save Text File( "test_batch_write_file_selfmade.bat", riga1, mode ("replace"));
Save Text File( "test_batch_write_file_selfmade.bat", riga2, mode ("append"));
Save Text File( "test_batch_write_file_selfmade.bat", riga3, mode ("append"));
open ("test_batch_write_file_selfmade.bat")
in this way you can create a hardwired bat file using variables from jmp, and be sure on where it will be executed
I would also like to point out the use of \!N in dghidoni's example.
compare:
SaveTextFile( "C:\Temp\cmddir.bat", "echo \!"directory list\!"\!N
dir\!N
pause\!N", mode("replace")) ;
to
SaveTextFile( "C:\Temp\cmddir.bat", "echo \!"directory list\!"
dir
pause", mode("replace")) ;
The first one (with \!N) works, the second one doesn't. Your text editor may not display the difference. But if you run cmd.exe and then type:
cd c:\temp
type cmddir.bat
you will see the difference.