|
Post by TheFeDuke on Feb 13, 2016 1:03:35 GMT -5
I place some code at the end of batch scripts for testing both in a 'DOS Prompt' window or using the RUN primary EDIT command. The script ends with no noise in the Command Prompt and closes the RUN window with just an 'Enter' after viewing output. [Edited: The original contribution has been generalized in anticipation of updates after v8.3.6022]. [Edited: Some simplification and added handling a window started by double-click]
:Xit SetLOCAL EnableDelayedExpansion&Set Clean="%CmdCmdLine:&=Ampersand%"&Set x=%~p0&Set x=!x:\run\=! For /F "tokens=1-2*" %%C In (%Clean%) Do If /I "%%D" EQU "/C" %ComSpec% /K Echo.Enter 'Exit' to end dbl-clk window... If "%x%" NEQ "%~p0" (Echo.Press 'Enter' to end SPF RUN window...&Pause>nul&Exit) Else Exit /B
The original code below should not be used after the .dot bug is fixed. [Edited: 8.4.6075 (Mar 15/2016) changed the ..]
Set "TILDEn=%~n0" %=== SPFLite RUN filename ends in ..BAT so close Window ===% If "%TILDEn:~-1%" EQU "." (Echo.Press 'Enter' to end SPF RUN window...&Pause>nul&Exit) Exit /B %=== End batch script leaving Window open in DOS Prompt ===%
I cannot contain my question of curiosity. Why does SPFLite use the RUN name in the format: batchname..bat ?
|
|
|
Post by George on Feb 13, 2016 12:03:31 GMT -5
I think we chose RUN since it didn't have any specific script language reference. e.g. the file could be BAT, VBS, JS, REXX, etc.
I must admit I'm envious of your BAT knowledge, I can barely follow some of the coding. I tend to use REXX for scripting.
George
|
|
|
Post by TheFeDuke on Feb 13, 2016 13:26:56 GMT -5
Thanks, George. My question was more about the extra period between the name and the extension in the generated temporary filename. I renamed ColorSPF.bat to ColorSPF.cmd and the RUN output was:
SPF Run command: 'J:\SPFLite.V8.3.6022\Config\RUN\ColorSPF..cmd' Volume in drive J is PINKFLASH Volume Serial Number is 0E08-2842
Directory of J:\SPFLite.V8.3.6022\Config\RUN
02/13/2016 12:55 PM 646 ColorSPF..cmd 1 File(s) 646 bytes 0 Dir(s) 505,344,000 bytes free Press 'Enter' to end SPF RUN window... I had a background of mainframe VM/REXX. I discovered how to start TSO in mainframe MVS and run REXX within it in my last contract. That was tricky because the devil in me could avoid deadline-defeating stringent program change control by just changing source code in an input data file that the paper-pushers did not recognize as programs. I did not pursue REXX on the PC , but your quick comment just reminded me to check it out again.
|
|
|
Post by George on Feb 13, 2016 14:19:50 GMT -5
Well, that extra period looks like a simple bug. A few versions back, all the internal functions that returned portions of a file path were standardized (I'd ended up over the years with a mish-mash of some that returned the trailing/leading . or \) and it was creating a bunch of misc. filename problems. Looks like I missed one. I'll check it out. George
[Update] Found and corrected for the next release. It was, as I thought, an Oops!
|
|
|
Post by TheFeDuke on Feb 14, 2016 13:59:54 GMT -5
I updated the first post in anticipation of your correction.
|
|