Approach using single script if other lang(VBS) is needed?
Posted: 25 May 2008 09:48
In some case, I want to use other scripting language(like VB script, perl, awk) to perform certain tasks that is hard to implement in DOS batch script. However, I will still need to create a DOS script to wrap around this other script so that I can run the whole thing with single command(I don't want to use the approach of using file extension association with which application to execute the scripting file)
I've created a batch file that create all VBScript code within the batch file to a temporary file(using %RAMDOM% for uniq filename) and execute it and delete that temporary VBScript file every time I execute the code.
However, I will need to mix echo. with VBScript code which makes VBScript troubleshooting/editing harder.
The primary goal is to keep everything(code, document, man page, ...) in the same single file to reduce the file management effort but without increasing the effort(as much as possible) on writing and troubleshooting of the code(in whatever format of its original scripting language form)
Right now, if I need to perform a task with VBScript, Perl and Awk script, I typically create 4 scripting files with same filename but different extension(file.cmd, file.vbs, file.awk, and file.pl) and keep them all on the same directory. file.cmd is used to get input parameters and call all other scripts and file.cmd will reside on a directory that is specified in PATH env variable. But then I have to change file.cmd every time I want to use a different directory to put these files on(or someone else have his/her own favorite directory name for these add-on scripts). I think I can use %~$PATH:I to help resolving this last challenge. However, I would still like to know how to do the same thing with just one batch script.
Thanks!
-Frank
I've created a batch file that create all VBScript code within the batch file to a temporary file(using %RAMDOM% for uniq filename) and execute it and delete that temporary VBScript file every time I execute the code.
However, I will need to mix echo. with VBScript code which makes VBScript troubleshooting/editing harder.
The primary goal is to keep everything(code, document, man page, ...) in the same single file to reduce the file management effort but without increasing the effort(as much as possible) on writing and troubleshooting of the code(in whatever format of its original scripting language form)
Right now, if I need to perform a task with VBScript, Perl and Awk script, I typically create 4 scripting files with same filename but different extension(file.cmd, file.vbs, file.awk, and file.pl) and keep them all on the same directory. file.cmd is used to get input parameters and call all other scripts and file.cmd will reside on a directory that is specified in PATH env variable. But then I have to change file.cmd every time I want to use a different directory to put these files on(or someone else have his/her own favorite directory name for these add-on scripts). I think I can use %~$PATH:I to help resolving this last challenge. However, I would still like to know how to do the same thing with just one batch script.
Thanks!
-Frank