Close everything and unzip all

Couple o’ quick productivity tips.

The first I posted on Twitter yesterday. That is, in Visual Studio, you can map Ctrl-Alt-F4 so that it closes all open document windows. It’s a noticeable time saver for me because I often get to the stage where I’m holding down Ctrl-F4 for about ten seconds waiting for it to close everything up.

Instructions:

  • In Visual Studio, go to Tool | Options
  • Under Environment select Keyboard
  • In Show commands containing, enter Window.CloseAllDocuments. You should get a single entry in the listbox below it
  • Put the cursor in Press shortcut keys and press Ctrl-Alt-F4.
  • Click OK

You can use whatever combination you like but check to see if it’s used by something else. I originally wanted Ctrl-Shift-F4 but ReSharper was using it for "Close recent tool". Haven’t determined what that means yet.

Next tip. When I get zip files, ninety-nine percent of the time, I do the same thing with them: Extract to <foldername>. That requires right-clicking on the file, navigating to the 7-Zip folder in the context menu, and selecting the appropriate option. I’m using 7-Zip as my archiver of choice primarily because it’s free, fast, and hasn’t gone the Paintshop Pro route of bloatedness like WinZip has.

(NOTE: You can configure 7-Zip’s context menu to get rid of things you don’t use, like Zip and E-mail. You can also make the menu non-cascading. The options are a little buried in the application but you’ll find them.)

7-Zip has a command-line version, as I suspect most archivers do. So after a browse through the documentation, I created a batch file as follows:

@echo off
set zipPath=%~dpn1
"C:\Program Files\7-Zip\7z.exe" x "%1" -o%zipPath% -y
pause

I’ve completely forgotten what the value after "set zipPath=" means but it was on the interwebs here somewhere. Sorry folks, the Hillbilly can’t be expected to remember everything he did last month. Like if he showered or not.

The next step here is to link this batch file to .zip files. I went the low-tech way by right-clicking a zip file, and selecting Choose Program… from the Open With context menu:

image

Select your newly-minted batch file and now zip files are extracted to <foldername> with a single click (or with an Enter for the keyboarders).

Notice that the zip file has a "pause" in the last line. That’s precautionary and can be removed if you like. I added it so I could see if there were any errors during the process.

That is all.

Kyle the Productive

This entry was posted in Utilities. Bookmark the permalink. Follow any comments here with the RSS feed for this post.
  • http://mikehadlow.blogspot.com Mike Hadlow

    You don’t need to map a new command to close all windows, the standard menu keyboard shorcuts work fine, just hit Alt-W, L

  • Skwr

    I usually chuck the close all windows command on the context menu for the document tab strip (i.e. where the filenames are shown)

    The line set zipPath=%~dpn1 bit is the real meat of the batch file. It extracts the drive, path and filename but no extension of the 1st argument to the batch file.
    E.g. if the call is ExtractToHere.bat c:\foo\bar.zip, then
    zippath = c:\foo\bar – i.e. the name of the directory that you want to create and unzip the files to.

  • http://sleeplessmonkey.com Steven Evans

    I can’t say I’ve ever reached the point where the Close All feature would be helpful, but the zip batch file is an awesome tip. I guess it’s never really hit me at the conscious level of how many steps it really is to unzip a file just to really dig into it.