8198
Using Arrays in Batch Files
Amendment to these instructions: add space as a delimiter or else you'll end up with stray spaces on the end of the array locations and/or values.

My solution:

set __MONTH.01=Jan
set __MONTH.02=Feb
set __MONTH.03=Mar
set __MONTH.04=Apr
set __MONTH.05=May
set __MONTH.06=Jun
set __MONTH.07=Jul
set __MONTH.08=Aug
set __MONTH.09=Sep
set __MONTH.10=Oct
set __MONTH.11=Nov
set __MONTH.12=Dec

REM See also:
REM http://ings.ca/jim/2008/02/10/adding-timestamps-in-a-dos-batch-file/
set cur_yyyy=%date:~10,4%
set cur_mm=%date:~4,2%

for /f "tokens=2* delims=.= " %%a in ('set __MONTH.') do (
if %%a == %cur_mm% set cur_mmm=%%b
)

set monthfolder="%cur_yyyy%-%cur_mm% (%cur_mmm%)"
if not exist %monthfolder% mkdir %monthfolder%
array  programming  batch  dos  batchprogramming  scripting  solution 
2 days ago
Batch -change month # to letters
First off, you can save yourself all those for statements. Since NT has a built-in DATE var, you can simply use substrings to get the parts you need.
In my case the DATE var is:
Sat 29-04-2006
so doing this:
set YYYYMMDD=%date:~10,4%%date:~7,2%%date:~4,2%
will set a new var called YYYYMMDD
BTW, it's not usually a good idea to alter a built-in var, like DATE.
Moving right along, I guess the simplest way to change 'numeric' month to 'named' month is with a chunk of code like this:
#####
if %MM%==01 set MM=Jan
if %MM%==02 set MM=Feb
if %MM%==03 set MM=Mar
if %MM%==04 set MM=Apr
and so on
#####

My solution:

set __MONTH.01=Jan
set __MONTH.02=Feb
set __MONTH.03=Mar
set __MONTH.04=Apr
set __MONTH.05=May
set __MONTH.06=Jun
set __MONTH.07=Jul
set __MONTH.08=Aug
set __MONTH.09=Sep
set __MONTH.10=Oct
set __MONTH.11=Nov
set __MONTH.12=Dec

REM See also:
REM http://ings.ca/jim/2008/02/10/adding-timestamps-in-a-dos-batch-file/
set cur_yyyy=%date:~10,4%
set cur_mm=%date:~4,2%

for /f "tokens=2* delims=.= " %%a in ('set __MONTH.') do (
if %%a == %cur_mm% set cur_mmm=%%b
)

set monthfolder="%cur_yyyy%-%cur_mm% (%cur_mmm%)"
if not exist %monthfolder% mkdir %monthfolder%
batchfile  batchprogramming  dos  datetime  scripting  tipsandtricks  dammitbrain  sysadmin  batch  programming  reference  solution 
2 days ago
Search for lines not containing pattern - Vim Tips Wiki
/v^(.*Warning)@!.*$
"Which works for a /word/, but which may not work for a phrase...

keywords:match find phrase word
vim  dammitbrain  searchandreplace  find  editing  tipsandtricks  essential  solution 
2 days ago
#632450 - ITP: pmatch -- Duplicate finder and removal tool. - Debian Bug report logs
Looks like including pmatch package in Debian is too controversial - so let's drop it, closing bug. Tomasz (Tomek) Muras
pmatch  duplicatefilefinder  filemanagement  deadproject  debian  bug 
2 days ago
Why Facebook is Killing Silicon Valley « Steve Blank
A serial tech entrepreneur muses on how Facebook and the social media craze is killing tech innovation. http://t.co/mnmlEypD
from instapaper
5 days ago
'Hug The Monster': Why So Many Climate Scientists Have Stopped Downplaying the Climate Threat | ThinkProgress
Oh HELL! ‘Hug The Monster’ Why So Many Climate Scientists Stopped Downplaying the Climate Threat http://t.co/hKkaIi1g via @thinkprogress
from instapaper
5 days ago
Can Anything Take Down the Facebook Juggernaut? | Epicenter | Wired.com
Love @stevenbjohnson's big-picture take on Facebook: http://t.co/rCtFS3SP (Also geeked out it's in @Wired & mentions I write there too!)
from instapaper
5 days ago
Pixel-fitting by Dustin Curtis
Font hinting is not the same as pixel fitting. Hinting is a fallible mathematical filter like antialiasing.

See: http://t.co/jLmKwdTX
from instapaper
5 days ago
amd graphics - WebGL on Google Chrome with AMD card - Ask Ubuntu
Even though WebGL is closest to OpenGL ES v2, every WebGL implementation that I know, including ours, supports desktop OpenGL too, but you need at least OpenGL 2.1 because WebGL is entirely based on the programmable pipeline. So indeed, OpenGL 1.5 is not good enough.
firefox  opengl  tilt  inspector  webdevel  solution  ubuntu  lucid 
5 days ago
Frequent head unloads info
Disabling APM entirely (hdparm -B255 /dev/sda) is not the most elegant solution (still need a script to do this on startup and resume from suspend/hibernate), but it does stop the load/unloads immediately. (And possibly reduces time on battery in the process.)
thinkpad  solution  hardware  harddiskdrive  powermanagement 
6 days ago
'The Information Diet': Should Americans Exercise More 'Conscious Consumption'? | PBS NewsHour | May 18, 2012 | PBS
"If you look at news and find yourself nodding your head a lot, time to insert diversity into your information diet." http://t.co/a9E9JQz2
6 days ago
CSS Drop Shadows
@davewiner: CSS Drop Shadows, borrowed from Nicolas Gallagher. Thanks! http://t.co/4yFske0S
css  dropshadow  webdevel  examplecode  via:ifttt  twitterfave  by:20gnd  from:twitter 
7 days ago
« earlier      
acf acfanimalsredesign2011 addon addressbook android annoyance antivirus apache app application art article audio audiophile backupandrecovery blog blogs browser bug by:20gnd calendar cdburning cheatsheet chrome cloudstorage codeeditor collaboration comic commandline console coolshit crossplatform css customization database dba dbase debian design designinspiration desktopcustomization development disasterrecovery driver drivers dropbox editor eeepc email encryption essential extension eyecandy facebook favorite feedreader filemanagement firefox flickr font fontfreak fonts food freesoftware freeware from:twitter funny geek gimp git gmail gnome google googleapps graphics gtk hacking hacks hardware hawaii howto html humor icons imageprocessing imap installation interesting ios iphone ipod java javascript jquery keepass keyboard language ldap library life2.0 linux list lists livecd mac mailfiltering marketing maybesolution mediawiki mozilla multimedia music mutt mysql mystuff nas nautilus networking news nonfree onlineretailers onlinestorage opensource osx outlook pdf perl photography php plugin plugins pptp printing privacy productivity programming project projects projectstowatch python quickreference reference remoteadministration remotedesktop rss rsync script scripting searchandindex searchengine security service services shellscripting socialmedia software solution spam ssh storage streaming synchronization syntaxhighlighting sysadmin systemmonitoring systemrecovery templates textediting thefuture theme thewaythingswere thinkpad thunderbird tipsandtricks todo troubleshooting tutorial twitter ubuntu ui unix utility via:ifttt video vim virtualbox virtualizationandemulation vista vnc vpn watchlist watchthisspace web webapp webapps webdesign webdevel webmaster website wiki windows windowsonly wine wireless wishlist wordpress work x11 xml

Copy this bookmark:



description:


tags: