home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.msdos.batch.nt      Fun with Windows NT batch files      68,980 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 67,469 of 68,980   
   a8412101@gmail.com to All   
   Re: Hybrid scripting   
   14 Dec 19 21:11:37   
   
   871056b4   
   بتاريخ الثلاثاء، 8 فبراير، 2011 5:26:00 م UTC+2،   
   كتب Tom Lavedas:   
   > I've been interested in the subject for quite a while.  The 'holy   
   > grail" has always been to find a way to have the script and batch all   
   > in one file.  The common solution is to create a temporary file to   
   > hold the script.  Recently I ran across a technique posted in an MS   
   > forum that I thought might be of interest here.  I'd give the author   
   > credit, but he is Japanese and I only have his Kanji moniker.  Anyway,   
   > his approach uses mshta.exe as the script host, rather than   
   > cscript.exe.  The beauty of his approach is that mshta accepts script   
   > input from its command line.  So, it is not necessary to commit the   
   > script to a file.  It can either be put as a literal on the command   
   > line or stored in an environment variable - which is how I have done   
   > it below for a script that returns the date in yyyymmdd format (locale   
   > independent) ...   
   >    
   >  @echo off   
   > ::   
   > :: Optional name   
   > ::   
   >   set name=MyDate   
   > ::   
   >   setlocal   
   > ::   
   > :: Setup script execution (needs no revision)   
   > ::   
   >   set "about=about:"'   
   >     ) do endlocal & set %name%=%%I   
   > ::   
   > :: Just here to demonstrate results   
   > ::   
   >   call echo For example, the date is %%%name%%%   
   >    
   > Note that the statement separator in JScript is the semicolon.   
   > _____________________   
   > Tom Lavedas   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca