home bbs files messages ]

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

   alt.os.windows.xp      Another Windows XP fan forum      2,222 messages   

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

   Message 2,161 of 2,222   
   Jim Wilkins to pyotr filipivich   
   Re: Stripping out special characters in    
   30 Jun 12 18:26:45   
   
   XPost: rec.crafts.metalworking, alt.comp.os.windows-xp, alt.os.windows-xp   
   From: muratlanne@gmail.com   
      
   "pyotr filipivich"  wrote in message   
   news:evkuu791r1vf5hpad6b311r5vn65j75roq@4ax.com...   
   > "Jim Wilkins"  on Sat, 30 Jun 2012 13:16:07   
   > -0400 typed in rec.crafts.metalworking  the following:   
   >>   
   >>"pyotr filipivich"  wrote in message   
   >>news:6n9uu798shu76bgl14c37ohnk1tvpr7eie@4ax.com...   
   >>> pyotr filipivich  on Fri, 29 Jun 2012   
   >>> 12:37:45   
   >>> -0700 typed in rec.crafts.metalworking  the following:   
   >>>   
   >>>>I knew posted a while back about wanting to import the date and   
   >>>>make   
   >>>>it part of a filename, automagically.   
   >>   
   >>The year_month_day format sorts into chronological order in folder   
   >>listings.   
   >   
   > Which is why I wanted it.  But %Date% fetches a string which can't   
   > be used in a file name.  I.E.,  "Sat 06/30/2012", so   
   > Filename%Date%.txt becomes "Filename Sat 06/30/2012.txt" and that is   
   > not a valid name.   
   > So the code I found lets you - "at the DOS prompt" - which is what   
   > a batch file is - get the date (and time) and put it into a useable   
   > format.   
   >   
   > for /f "tokens=1-4 delims=/ " %%a in ('date /t') do (set   
   > weekday=%%a& set month=%%b& set day=%%c& set year=%%d)   
   > for /f %%a in ('time /t') do set time=%%a   
   > for /f "tokens=1-3 delims=: " %%a in ('time /t') do (set   
   > hours=%%a& set minutes=%%b& set TheEnd=%%c)   
   > Set Date_Hack=%year%%month%%day%-%hours%%minutes%   
   >   
   > So I can name a file File%Date_Hack%.txt and get   
   > File20120630-1237.txt   
   > Which is legit.  And in ISO sort order, too.   
   >   
   > ANd the "program" works and I am just so happy ...   
   >   
   > I even feel "clever".  B-)   
   > pyotr   
      
   You should.   
   That's much more than I've ever had to do in a batch file.   
      
   jsw   
      
   --- 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