Monday, October 26, 2009

Advanced Batch Commands: Command Line Parameters

Starting from Windows NT 4, command line parameters can be retrieved in the following ways.
  • %CmdCmdLine%
    Returns the entire command line as passed to CMD.EXE.  It leaves all delimiters intact, except, in Windows 2000 and later, leading spaces before the first argument.
  • %*
    Returns the remainder of the command line starting from the first argument.  It also leaves all delimiters intact, except, in Windows 2000 and later, leading spaces before the first argument.
  • %~dn
    Returns the drive letter of %n (n can range from 0 to 9) if %n is a valid path or file name (no UNC)
  • %~pn
    Returns the directory of %n if %n is a valid path or file name (no UNC)
  • %~nn
    Returns the file name only of %n if %n is a valid file name
  • %~xn
    Returns the file extension only of %n if %n is a valid file name
  • %~fn
    Returns the fully qualified path of %n if %n is a valid file name or directory
To remove the leading space of %* included by NT 4 use the following commands:

    SET commandline=%*
    IF NOT CMDEXTVERSION 2 SET commandline=%commandline:~1%

Wednesday, September 23, 2009

Tips on Windows 7 Sticky Notes (Undocumented)

If you're looking for shortcut keys for Windows 7 Sticky Notes, there are actually more keyboard shortcuts than Microsoft has documented here.

The following table contains all the keyboard shortcuts that I found for Windows 7 Sticky Notes. If you found more, please let me know.

General (File) Commands
Press this key
To do this
Ctrl+N
Create a new sticky note
Ctrl+D
Delete sticky note
F10
Highlight the controls on the title bar
Shift+F10
Show the context menu
F1
Open Sticky Notes Help
Ctrl+Tab
Switch between notes
Alt+F4
Close Sticky Notes program

Edit Commands
Press this key
To do this
Ctrl+Z
Undo a change
Ctrl+Y
Redo a change
Ctrl+A
Select the entire note
Ctrl+X
Cut a selection
Ctrl+C
Copy a selection to the Clipboard
Ctrl+V
Paste a selection from the Clipboard
Ctrl+Delete
Delete the next word

Formatting Commands
Press this key
To do this
Ctrl+B
Make selected text bold
Ctrl+I
Italicize selected text
Ctrl+T
Strike through selected text
Ctrl+U
Underline selected text
Ctrl+=
Make selected text subscript
Ctrl+Shift+=
Make selected text superscript
Ctrl+L
Align text left
Ctrl+E
Align text center
Ctrl+R
Align text right
Ctrl+1
Set single line spacing
Ctrl+2
Set double line spacing
Ctrl+5
Set line spacing to 1.5
Ctrl+Shift+>
Increase the font size
Ctrl+Shift+<
Decrease the font size
Ctrl+Mouse Scroll
Increase/decrease font size of the whole note or selected text
Ctrl+Shift+A
Change characters to all capitals
Ctrl+Shift+L
Change the bullet style

Cursor Movement
Press this key
To do this
Ctrl+Left Arrow
Move the cursor one word to the left
Ctrl+Right Arrow
Move the cursor one word to the right
Ctrl+Up Arrow
Move the cursor to the line above
Ctrl+Down Arrow
Move the cursor to the line below
Ctrl+Home
Move to the beginning of the note
Ctrl+End
Move to the end of the note

How to backup Windows 7 Sticky Notes

All Sticky Notes are stored in a file called StickyNotes.snt under this folder: %APPDATA%\Microsoft\Sticky Notes\. Always keep an up-to-date backup copy of this file, then you are good to go.

Tuesday, August 4, 2009

E538: No mouse support: mouse=a

Sometimes I got this error when some applications try to load VIM as my default editor. The fix is simple, just open up your .vimrc file and change the following line:
set mouse=a

to:
if has("mouse")
set mouse=a
endif