Posts

Showing posts from May, 2010

The power of shift clicking – Copy As Path

Image
  Have you ever been in explorer and needed to get the path of a file? Turns out that feature is built into Windows 7! If you shift right click on a file, the menu contains a copy as path link.  Sweet!

The joy's of batch - Delayed Expansion

  If you can, skip batch and move strait to powershell. If you don't believe me, maybe this blog post will change your mind. In batch %ErrorLevel% is how you know if the last command succeeded: C:\>echo %ERRORLEVEL% 0 It turns out if you set a variable that doesn't exist, this sets error code to 1. So C:\>set DONKEYRIDING Environment variable DONKEYRIDING not defined C:\>echo %ERRORLEVEL% 1 Makes sense, batch isn't that bad you think. Now here's a pop quiz - What will you get when you run this batch file? C:\>type foo.bat if NOT "BATCH"=="OBVIOUS" ( echo %ERRORLEVEL% set DONKEYRIDING echo %ERRORLEVEL% ) I"ll run it for you: C:\>foo.bat C:\>if NOT "BATCH" == "OBVIOUS" ( echo 0 set DONKEYRIDING echo 0 ) 0 Environment variable DONKEYRIDING not defined 0 C:\> Not what you thunk huh? Maybe error level wasn't set - lets check C:\>echo %ERRORLEVEL% 1 What the