2012/12/04

WM (Constants)

Definitions / Descriptions

WM_ACTIVATE 0x6 The WM_ACTIVATE message is sent when a window is being activated or deactivated. This message is sent first to the window procedure of the top-level window being deactivated; it is then sent to the window procedure of the top-level window being activated.
WM_ACTIVATEAPP 0x1C The WM_ACTIVATEAPP message is sent when a window belonging to a different application than the active window is about to be activated. The message is sent to the application whose window is being activated and to the application whose window is being deactivated.
WM_AFXFIRST 0x360 The WM_AFXFIRST specifies the first afx message.
WM_AFXLAST 0x37F The WM_AFXFIRST specifies the last afx message.
WM_APP 0x8000 The WM_APP constant is used by applications to help define private messages, usually of the form WM_APP+X, where X is an integer value.
WM_ASKCBFORMATNAME 0x30C The WM_ASKCBFORMATNAME message is sent to the clipboard owner by a clipboard viewer window to request the name of a CF_OWNERDISPLAY clipboard format.
WM_CANCELJOURNAL 0x4B The WM_CANCELJOURNAL message is posted to an application when a user cancels the application's journaling activities. The message is posted with a NULL window handle.
WM_CANCELMODE 0x1F The WM_CANCELMODE message is sent to cancel certain modes, such as mouse capture. For example, the system sends this message to the active window when a dialog box or message box is displayed. Certain functions also send this message explicitly to the specified window regardless of whether it is the active window. For example, the EnableWindow function sends this message when disabling the specified window.
WM_CAPTURECHANGED 0x215 The WM_CAPTURECHANGED message is sent to the window that is losing the mouse capture.
WM_CHANGECBCHAIN 0x30D The WM_CHANGECBCHAIN message is sent to the first window in the clipboard viewer chain when a window is being removed from the chain.
WM_CHANGEUISTATE 0x127 An application sends the WM_CHANGEUISTATE message to indicate that the user interface (UI) state should be changed.
WM_CHAR 0x102 The WM_CHAR message is posted to the window with the keyboard focus when a WM_KEYDOWN message is translated by the TranslateMessage function. The WM_CHAR message contains the character code of the key that was pressed.
WM_CHARTOITEM 0x2F Sent by a list box with the LBS_WANTKEYBOARDINPUT style to its owner in response to a WM_CHAR message.
WM_CHILDACTIVATE 0x22 The WM_CHILDACTIVATE message is sent to a child window when the user clicks the window's title bar or when the window is activated, moved, or sized.
WM_CLEAR 0x303 An application sends a WM_CLEAR message to an edit control or combo box to delete (clear) the current selection, if any, from the edit control.
WM_CLOSE 0x10 The WM_CLOSE message is sent as a signal that a window or an application should terminate.
WM_COMMAND 0x111 The WM_COMMAND message is sent when the user selects a command item from a menu, when a control sends a notification message to its parent window, or when an accelerator keystroke is translated.
WM_COMPACTING 0x41 The WM_COMPACTING message is sent to all top-level windows when the system detects more than 12.5 percent of system time over a 30- to 60-second interval is being spent compacting memory. This indicates that system memory is low.
WM_COMPAREITEM 0x39 The system sends the WM_COMPAREITEM message to determine the relative position of a new item in the sorted list of an owner-drawn combo box or list box. Whenever the application adds a new item, the system sends this message to the owner of a combo box or list box created with the CBS_SORT or LBS_SORT style.
WM_CONTEXTMENU 0x7B The WM_CONTEXTMENU message notifies a window that the user clicked the right mouse button (right-clicked) in the window.
WM_COPY 0x301 An application sends the WM_COPY message to an edit control or combo box to copy the current selection to the clipboard in CF_TEXT format.
WM_COPYDATA 0x4A An application sends the WM_COPYDATA message to pass data to another application.
WM_CREATE 0x1 The WM_CREATE message is sent when an application requests that a window be created by calling the CreateWindowEx or CreateWindow function. (The message is sent before the function returns.) The window procedure of the new window receives this message after the window is created, but before the window becomes visible.
WM_CTLCOLORBTN 0x135 The WM_CTLCOLORBTN message is sent to the parent window of a button before drawing the button. The parent window can change the button's text and background colors. However, only owner-drawn buttons respond to the parent window processing this message.
WM_CTLCOLORDLG 0x136 The WM_CTLCOLORDLG message is sent to a dialog box before the system draws the dialog box. By responding to this message, the dialog box can set its text and background colors using the specified display device context handle.
WM_CTLCOLOREDIT 0x133 An edit control that is not read-only or disabled sends the WM_CTLCOLOREDIT message to its parent window when the control is about to be drawn. By responding to this message, the parent window can use the specified device context handle to set the text and background colors of the edit control.
WM_CTLCOLORLISTBOX 0x134 Sent to the parent window of a list box before the system draws the list box. By responding to this message, the parent window can set the text and background colors of the list box by using the specified display device context handle.
WM_CTLCOLORMSGBOX 0x132 The WM_CTLCOLORMSGBOX message is sent to the owner window of a message box before Windows draws the message box. By responding to this message, the owner window can set the text and background colors of the message box by using the given display device context handle.
WM_CTLCOLORSCROLLBAR 0x137 The WM_CTLCOLORSCROLLBAR message is sent to the parent window of a scroll bar control when the control is about to be drawn. By responding to this message, the parent window can use the display context handle to set the background color of the scroll bar control.
WM_CTLCOLORSTATIC 0x138 A static control, or an edit control that is read-only or disabled, sends the WM_CTLCOLORSTATIC message to its parent window when the control is about to be drawn. By responding to this message, the parent window can use the specified device context handle to set the text and background colors of the static control.
WM_CUT 0x300 An application sends a WM_CUT message to an edit control or combo box to delete (cut) the current selection, if any, in the edit control and copy the deleted text to the clipboard in CF_TEXT format.
WM_DEADCHAR 0x103 The WM_DEADCHAR message is posted to the window with the keyboard focus when a WM_KEYUP message is translated by the TranslateMessage function. WM_DEADCHAR specifies a character code generated by a dead key. A dead key is a key that generates a character, such as the umlaut (double-dot), that is combined with another character to form a composite character. For example, the umlaut-O character (Ö) is generated by typing the dead key for the umlaut character, and then typing the O key.
WM_DELETEITEM 0x2D Sent to the owner of a list box or combo box when the list box or combo box is destroyed or when items are removed by the LB_DELETESTRING, LB_RESETCONTENT, CB_DELETESTRING, or CB_RESETCONTENT message. The system sends a WM_DELETEITEM message for each deleted item. The system sends the WM_DELETEITEM message for any deleted list box or combo box item with nonzero item data.
WM_DESTROY 0x2 The WM_DESTROY message is sent when a window is being destroyed. It is sent to the window procedure of the window being destroyed after the window is removed from the screen. This message is sent first to the window being destroyed and then to the child windows (if any) as they are destroyed. During the processing of the message, it can be assumed that all child windows still exist.
WM_DESTROYCLIPBOARD 0x307 The WM_DESTROYCLIPBOARD message is sent to the clipboard owner when a call to the EmptyClipboard function empties the clipboard.
WM_DEVICECHANGE 0x219 Notifies an application of a change to the hardware configuration of a device or the computer.
WM_DEVMODECHANGE 0x1B The WM_DEVMODECHANGE message is sent to all top-level windows whenever the user changes device-mode settings.
WM_DISPLAYCHANGE 0x7E The WM_DISPLAYCHANGE message is sent to all windows when the display resolution has changed.
WM_DRAWCLIPBOARD 0x308 The WM_DRAWCLIPBOARD message is sent to the first window in the clipboard viewer chain when the content of the clipboard changes. This enables a clipboard viewer window to display the new content of the clipboard.
WM_DRAWITEM 0x2B The WM_DRAWITEM message is sent to the parent window of an owner-drawn button, combo box, list box, or menu when a visual aspect of the button, combo box, list box, or menu has changed.
WM_DROPFILES 0x233 Sent when the user drops a file on the window of an application that has registered itself as a recipient of dropped files.
WM_ENABLE 0xA The WM_ENABLE message is sent when an application changes the enabled state of a window. It is sent to the window whose enabled state is changing. This message is sent before the EnableWindow function returns, but after the enabled state (WS_DISABLED style bit) of the window has changed.
WM_ENDSESSION 0x16 The WM_ENDSESSION message is sent to an application after the system processes the results of the WM_QUERYENDSESSION message. The WM_ENDSESSION message informs the application whether the session is ending.
WM_ENTERIDLE 0x121 The WM_ENTERIDLE message is sent to the owner window of a modal dialog box or menu that is entering an idle state. A modal dialog box or menu enters an idle state when no messages are waiting in its queue after it has processed one or more previous messages.
WM_ENTERMENULOOP 0x211 The WM_ENTERMENULOOP message informs an application's main window procedure that a menu modal loop has been entered.
WM_ENTERSIZEMOVE 0x231 The WM_ENTERSIZEMOVE message is sent one time to a window after it enters the moving or sizing modal loop. The window enters the moving or sizing modal loop when the user clicks the window's title bar or sizing border, or when the window passes the WM_SYSCOMMAND message to the DefWindowProc function and the wParam parameter of the message specifies the SC_MOVE or SC_SIZE value. The operation is complete when DefWindowProc returns.
WM_ERASEBKGND 0x14 The WM_ERASEBKGND message is sent when the window background must be erased (for example, when a window is resized). The message is sent to prepare an invalidated portion of a window for painting.
WM_EXITMENULOOP 0x212 The WM_EXITMENULOOP message informs an application's main window procedure that a menu modal loop has been exited.
WM_EXITSIZEMOVE 0x232 The WM_EXITSIZEMOVE message is sent one time to a window, after it has exited the moving or sizing modal loop. The window enters the moving or sizing modal loop when the user clicks the window's title bar or sizing border, or when the window passes the WM_SYSCOMMAND message to the DefWindowProc function and the wParam parameter of the message specifies the SC_MOVE or SC_SIZE value. The operation is complete when DefWindowProc returns.
WM_FONTCHANGE 0x1D An application sends the WM_FONTCHANGE message to all top-level windows in the system after changing the pool of font resources.
WM_GETDLGCODE 0x87 The WM_GETDLGCODE message is sent to the window procedure associated with a control. By default, the system handles all keyboard input to the control; the system interprets certain types of keyboard input as dialog box navigation keys. To override this default behavior, the control can respond to the WM_GETDLGCODE message to indicate the types of input it wants to process itself.
WM_GETFONT 0x31 An application sends a WM_GETFONT message to a control to retrieve the font with which the control is currently drawing its text.
WM_GETHOTKEY 0x33 An application sends a WM_GETHOTKEY message to determine the hot key associated with a window.
WM_GETICON 0x7F The WM_GETICON message is sent to a window to retrieve a handle to the large or small icon associated with a window. The system displays the large icon in the ALT+TAB dialog, and the small icon in the window caption.
WM_GETMINMAXINFO 0x24 The WM_GETMINMAXINFO message is sent to a window when the size or position of the window is about to change. An application can use this message to override the window's default maximized size and position, or its default minimum or maximum tracking size.
WM_GETOBJECT 0x3D Active Accessibility sends the WM_GETOBJECT message to obtain information about an accessible object contained in a server application. Applications never send this message directly. It is sent only by Active Accessibility in response to calls to AccessibleObjectFromPoint, AccessibleObjectFromEvent, or AccessibleObjectFromWindow. However, server applications handle this message.
WM_GETTEXT 0xD An application sends a WM_GETTEXT message to copy the text that corresponds to a window into a buffer provided by the caller.
WM_GETTEXTLENGTH 0xE An application sends a WM_GETTEXTLENGTH message to determine the length, in characters, of the text associated with a window.
WM_HANDHELDFIRST 0x358 Definition Needed
WM_HANDHELDLAST 0x35F Definition Needed
WM_HELP 0x53 Indicates that the user pressed the F1 key. If a menu is active when F1 is pressed, WM_HELP is sent to the window associated with the menu; otherwise, WM_HELP is sent to the window that has the keyboard focus. If no window has the keyboard focus, WM_HELP is sent to the currently active window.
WM_HOTKEY 0x312 The WM_HOTKEY message is posted when the user presses a hot key registered by the RegisterHotKey function. The message is placed at the top of the message queue associated with the thread that registered the hot key.
WM_HSCROLL 0x114 This message is sent to a window when a scroll event occurs in the window's standard horizontal scroll bar. This message is also sent to the owner of a horizontal scroll bar control when a scroll event occurs in the control.
WM_HSCROLLCLIPBOARD 0x30E The WM_HSCROLLCLIPBOARD message is sent to the clipboard owner by a clipboard viewer window. This occurs when the clipboard contains data in the CF_OWNERDISPLAY format and an event occurs in the clipboard viewer's horizontal scroll bar. The owner should scroll the clipboard image and update the scroll bar values.
WM_ICONERASEBKGND 0x27 Windows NT 3.51 and earlier: The WM_ICONERASEBKGND message is sent to a minimized window when the background of the icon must be filled before painting the icon. A window receives this message only if a class icon is defined for the window; otherwise, WM_ERASEBKGND is sent. This message is not sent by newer versions of Windows.
WM_IME_CHAR 0x286 Sent to an application when the IME gets a character of the conversion result. A window receives this message through its WindowProc function.
WM_IME_COMPOSITION 0x10F Sent to an application when the IME changes composition status as a result of a keystroke. A window receives this message through its WindowProc function.
WM_IME_COMPOSITIONFULL 0x284 Sent to an application when the IME window finds no space to extend the area for the composition window. A window receives this message through its WindowProc function.
WM_IME_CONTROL 0x283 Sent by an application to direct the IME window to carry out the requested command. The application uses this message to control the IME window that it has created. To send this message, the application calls the SendMessage function with the following parameters.
WM_IME_ENDCOMPOSITION 0x10E Sent to an application when the IME ends composition. A window receives this message through its WindowProc function.
WM_IME_KEYDOWN 0x290 Sent to an application by the IME to notify the application of a key press and to keep message order. A window receives this message through its WindowProc function.
WM_IME_KEYLAST 0x10F Definition Needed
WM_IME_KEYUP 0x291 Sent to an application by the IME to notify the application of a key release and to keep message order. A window receives this message through its WindowProc function.
WM_IME_NOTIFY 0x282 Sent to an application to notify it of changes to the IME window. A window receives this message through its WindowProc function.
WM_IME_REQUEST 0x288 Sent to an application to provide commands and request information. A window receives this message through its WindowProc function.
WM_IME_SELECT 0x285 Sent to an application when the operating system is about to change the current IME. A window receives this message through its WindowProc function.
WM_IME_SETCONTEXT 0x281 Sent to an application when a window is activated. A window receives this message through its WindowProc function.
WM_IME_STARTCOMPOSITION 0x10D Sent immediately before the IME generates the composition string as a result of a keystroke. A window receives this message through its WindowProc function.
WM_INITDIALOG 0x110 The WM_INITDIALOG message is sent to the dialog box procedure immediately before a dialog box is displayed. Dialog box procedures typically use this message to initialize controls and carry out any other initialization tasks that affect the appearance of the dialog box.
WM_INITMENU 0x116 The WM_INITMENU message is sent when a menu is about to become active. It occurs when the user clicks an item on the menu bar or presses a menu key. This allows the application to modify the menu before it is displayed.
WM_INITMENUPOPUP 0x117 The WM_INITMENUPOPUP message is sent when a drop-down menu or submenu is about to become active. This allows an application to modify the menu before it is displayed, without changing the entire menu.
WM_INPUTLANGCHANGE 0x51 The WM_INPUTLANGCHANGE message is sent to the topmost affected window after an application's input language has been changed. You should make any application-specific settings and pass the message to the DefWindowProc function, which passes the message to all first-level child windows. These child windows can pass the message to DefWindowProc to have it pass the message to their child windows, and so on.
WM_INPUTLANGCHANGEREQUEST 0x50 The WM_INPUTLANGCHANGEREQUEST message is posted to the window with the focus when the user chooses a new input language, either with the hotkey (specified in the Keyboard control panel application) or from the indicator on the system taskbar. An application can accept the change by passing the message to the DefWindowProc function or reject the change (and prevent it from taking place) by returning immediately.
WM_KEYDOWN 0x100 The WM_KEYDOWN message is posted to the window with the keyboard focus when a nonsystem key is pressed. A nonsystem key is a key that is pressed when the ALT key is not pressed.
WM_KEYFIRST 0x100 This message filters for keyboard messages.
WM_KEYLAST 0x108 This message filters for keyboard messages.
WM_KEYUP 0x101 The WM_KEYUP message is posted to the window with the keyboard focus when a nonsystem key is released. A nonsystem key is a key that is pressed when the ALT key is not pressed, or a keyboard key that is pressed when a window has the keyboard focus.
WM_KILLFOCUS 0x8 The WM_KILLFOCUS message is sent to a window immediately before it loses the keyboard focus.
WM_LBUTTONDBLCLK 0x203 The WM_LBUTTONDBLCLK message is posted when the user double-clicks the left mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
WM_LBUTTONDOWN 0x201 The WM_LBUTTONDOWN message is posted when the user presses the left mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
WM_LBUTTONUP 0x202 The WM_LBUTTONUP message is posted when the user releases the left mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
WM_MBUTTONDBLCLK 0x209 The WM_MBUTTONDBLCLK message is posted when the user double-clicks the middle mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
WM_MBUTTONDOWN 0x207 The WM_MBUTTONDOWN message is posted when the user presses the middle mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
WM_MBUTTONUP 0x208 The WM_MBUTTONUP message is posted when the user releases the middle mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
WM_MDIACTIVATE 0x222 An application sends the WM_MDIACTIVATE message to a multiple-document interface (MDI) client window to instruct the client window to activate a different MDI child window.
WM_MDICASCADE 0x227 An application sends the WM_MDICASCADE message to a multiple-document interface (MDI) client window to arrange all its child windows in a cascade format.
WM_MDICREATE 0x220 An application sends the WM_MDICREATE message to a multiple-document interface (MDI) client window to create an MDI child window.
WM_MDIDESTROY 0x221 An application sends the WM_MDIDESTROY message to a multiple-document interface (MDI) client window to close an MDI child window.
WM_MDIGETACTIVE 0x229 An application sends the WM_MDIGETACTIVE message to a multiple-document interface (MDI) client window to retrieve the handle to the active MDI child window.
WM_MDIICONARRANGE 0x228 An application sends the WM_MDIICONARRANGE message to a multiple-document interface (MDI) client window to arrange all minimized MDI child windows. It does not affect child windows that are not minimized.
WM_MDIMAXIMIZE 0x225 An application sends the WM_MDIMAXIMIZE message to a multiple-document interface (MDI) client window to maximize an MDI child window. The system resizes the child window to make its client area fill the client window. The system places the child window's window menu icon in the rightmost position of the frame window's menu bar, and places the child window's restore icon in the leftmost position. The system also appends the title bar text of the child window to that of the frame window.
WM_MDINEXT 0x224 An application sends the WM_MDINEXT message to a multiple-document interface (MDI) client window to activate the next or previous child window.
WM_MDIREFRESHMENU 0x234 An application sends the WM_MDIREFRESHMENU message to a multiple-document interface (MDI) client window to refresh the window menu of the MDI frame window.
WM_MDIRESTORE 0x223 An application sends the WM_MDIRESTORE message to a multiple-document interface (MDI) client window to restore an MDI child window from maximized or minimized size.
WM_MDISETMENU 0x230 An application sends the WM_MDISETMENU message to a multiple-document interface (MDI) client window to replace the entire menu of an MDI frame window, to replace the window menu of the frame window, or both.
WM_MDITILE 0x226 An application sends the WM_MDITILE message to a multiple-document interface (MDI) client window to arrange all of its MDI child windows in a tile format.
WM_MEASUREITEM 0x2C The WM_MEASUREITEM message is sent to the owner window of a combo box, list box, list view control, or menu item when the control or menu is created.
WM_MENUCHAR 0x120 The WM_MENUCHAR message is sent when a menu is active and the user presses a key that does not correspond to any mnemonic or accelerator key. This message is sent to the window that owns the menu.
WM_MENUCOMMAND 0x126 The WM_MENUCOMMAND message is sent when the user makes a selection from a menu.
WM_MENUDRAG 0x123 The WM_MENUDRAG message is sent to the owner of a drag-and-drop menu when the user drags a menu item.
WM_MENUGETOBJECT 0x124 The WM_MENUGETOBJECT message is sent to the owner of a drag-and-drop menu when the mouse cursor enters a menu item or moves from the center of the item to the top or bottom of the item.
WM_MENURBUTTONUP 0x122 The WM_MENURBUTTONUP message is sent when the user releases the right mouse button while the cursor is on a menu item.
WM_MENUSELECT 0x11F The WM_MENUSELECT message is sent to a menu's owner window when the user selects a menu item.
WM_MOUSEACTIVATE 0x21 The WM_MOUSEACTIVATE message is sent when the cursor is in an inactive window and the user presses a mouse button. The parent window receives this message only if the child window passes it to the DefWindowProc function.
WM_MOUSEFIRST 0x200 Use WM_MOUSEFIRST to specify the first mouse message. Use the PeekMessage() Function.
WM_MOUSEHOVER 0x2A1 The WM_MOUSEHOVER message is posted to a window when the cursor hovers over the client area of the window for the period of time specified in a prior call to TrackMouseEvent.
WM_MOUSELAST 0x20D Definition Needed
WM_MOUSELEAVE 0x2A3 The WM_MOUSELEAVE message is posted to a window when the cursor leaves the client area of the window specified in a prior call to TrackMouseEvent.
WM_MOUSEMOVE 0x200 The WM_MOUSEMOVE message is posted to a window when the cursor moves. If the mouse is not captured, the message is posted to the window that contains the cursor. Otherwise, the message is posted to the window that has captured the mouse.
WM_MOUSEWHEEL 0x20A The WM_MOUSEWHEEL message is sent to the focus window when the mouse wheel is rotated. The DefWindowProc function propagates the message to the window's parent. There should be no internal forwarding of the message, since DefWindowProc propagates it up the parent chain until it finds a window that processes it.
WM_MOUSEHWHEEL 0x20E The WM_MOUSEHWHEEL message is sent to the focus window when the mouse's horizontal scroll wheel is tilted or rotated. The DefWindowProc function propagates the message to the window's parent. There should be no internal forwarding of the message, since DefWindowProc propagates it up the parent chain until it finds a window that processes it.
WM_MOVE 0x3 The WM_MOVE message is sent after a window has been moved.
WM_MOVING 0x216 The WM_MOVING message is sent to a window that the user is moving. By processing this message, an application can monitor the position of the drag rectangle and, if needed, change its position.
WM_NCACTIVATE 0x86 Non Client Area Activated Caption(Title) of the Form
WM_NCCALCSIZE 0x83 The WM_NCCALCSIZE message is sent when the size and position of a window's client area must be calculated. By processing this message, an application can control the content of the window's client area when the size or position of the window changes.
WM_NCCREATE 0x81 The WM_NCCREATE message is sent prior to the WM_CREATE message when a window is first created.
WM_NCDESTROY 0x82 The WM_NCDESTROY message informs a window that its nonclient area is being destroyed. The DestroyWindow function sends the WM_NCDESTROY message to the window following the WM_DESTROY message. WM_DESTROY is used to free the allocated memory object associated with the window.
WM_NCHITTEST 0x84 The WM_NCHITTEST message is sent to a window when the cursor moves, or when a mouse button is pressed or released. If the mouse is not captured, the message is sent to the window beneath the cursor. Otherwise, the message is sent to the window that has captured the mouse.
WM_NCLBUTTONDBLCLK 0xA3 The WM_NCLBUTTONDBLCLK message is posted when the user double-clicks the left mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
WM_NCLBUTTONDOWN 0xA1 The WM_NCLBUTTONDOWN message is posted when the user presses the left mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
WM_NCLBUTTONUP 0xA2 The WM_NCLBUTTONUP message is posted when the user releases the left mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
WM_NCMBUTTONDBLCLK 0xA9 The WM_NCMBUTTONDBLCLK message is posted when the user double-clicks the middle mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
WM_NCMBUTTONDOWN 0xA7 The WM_NCMBUTTONDOWN message is posted when the user presses the middle mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
WM_NCMBUTTONUP 0xA8 The WM_NCMBUTTONUP message is posted when the user releases the middle mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
WM_NCMOUSEMOVE 0xA0 The WM_NCMOUSEMOVE message is posted to a window when the cursor is moved within the nonclient area of the window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
WM_NCPAINT 0x85 The WM_NCPAINT message is sent to a window when its frame must be painted.
WM_NCRBUTTONDBLCLK 0xA6 The WM_NCRBUTTONDBLCLK message is posted when the user double-clicks the right mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
WM_NCRBUTTONDOWN 0xA4 The WM_NCRBUTTONDOWN message is posted when the user presses the right mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
WM_NCRBUTTONUP 0xA5 The WM_NCRBUTTONUP message is posted when the user releases the right mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.
WM_NCUAHDRAWCAPTION 0xAE The WM_NCUAHDRAWCAPTION message is an undocumented message related to themes. When handling WM_NCPAINT, this message should also be handled.
WM_NCUAHDRAWFRAME 0xAF The WM_NCUAHDRAWFRAME message is an undocumented message related to themes. When handling WM_NCPAINT, this message should also be handled.
WM_NEXTDLGCTL 0x28 The WM_NEXTDLGCTL message is sent to a dialog box procedure to set the keyboard focus to a different control in the dialog box
WM_NEXTMENU 0x213 The WM_NEXTMENU message is sent to an application when the right or left arrow key is used to switch between the menu bar and the system menu.
WM_NOTIFY 0x4E Sent by a common control to its parent window when an event has occurred or the control requires some information.
WM_NOTIFYFORMAT 0x55 Determines if a window accepts ANSI or Unicode structures in the WM_NOTIFY notification message. WM_NOTIFYFORMAT messages are sent from a common control to its parent window and from the parent window to the common control.
WM_NULL 0x0 The WM_NULL message performs no operation. An application sends the WM_NULL message if it wants to post a message that the recipient window will ignore.
WM_PAINT 0xF Occurs when the control needs repainting
WM_PAINTCLIPBOARD 0x309 The WM_PAINTCLIPBOARD message is sent to the clipboard owner by a clipboard viewer window when the clipboard contains data in the CF_OWNERDISPLAY format and the clipboard viewer's client area needs repainting.
WM_PAINTICON 0x26 Windows NT 3.51 and earlier: The WM_PAINTICON message is sent to a minimized window when the icon is to be painted. This message is not sent by newer versions of Microsoft Windows, except in unusual circumstances explained in the Remarks.
WM_PALETTECHANGED 0x311 This message is sent by the OS to all top-level and overlapped windows after the window with the keyboard focus realizes its logical palette. This message enables windows that do not have the keyboard focus to realize their logical palettes and update their client areas.
WM_PALETTEISCHANGING 0x310 The WM_PALETTEISCHANGING message informs applications that an application is going to realize its logical palette.
WM_PARENTNOTIFY 0x210 The WM_PARENTNOTIFY message is sent to the parent of a child window when the child window is created or destroyed, or when the user clicks a mouse button while the cursor is over the child window. When the child window is being created, the system sends WM_PARENTNOTIFY just before the CreateWindow or CreateWindowEx function that creates the window returns. When the child window is being destroyed, the system sends the message before any processing to destroy the window takes place.
WM_PASTE 0x302 An application sends a WM_PASTE message to an edit control or combo box to copy the current content of the clipboard to the edit control at the current caret position. Data is inserted only if the clipboard contains data in CF_TEXT format.
WM_PENWINFIRST 0x380 Definition Needed
WM_PENWINLAST 0x38F Definition Needed
WM_POWER 0x48 Notifies applications that the system, typically a battery-powered personal computer, is about to enter a suspended mode. Obsolete : use POWERBROADCAST instead
WM_POWERBROADCAST 0x218 Notifies applications that a power-management event has occurred.
WM_PRINT 0x317 The WM_PRINT message is sent to a window to request that it draw itself in the specified device context, most commonly in a printer device context.
WM_PRINTCLIENT 0x318 The WM_PRINTCLIENT message is sent to a window to request that it draw its client area in the specified device context, most commonly in a printer device context.
WM_QUERYDRAGICON 0x37 The WM_QUERYDRAGICON message is sent to a minimized (iconic) window. The window is about to be dragged by the user but does not have an icon defined for its class. An application can return a handle to an icon or cursor. The system displays this cursor or icon while the user drags the icon.
WM_QUERYENDSESSION 0x11 The WM_QUERYENDSESSION message is sent when the user chooses to end the session or when an application calls one of the system shutdown functions. If any application returns zero, the session is not ended. The system stops sending WM_QUERYENDSESSION messages as soon as one application returns zero. After processing this message, the system sends the WM_ENDSESSION message with the wParam parameter set to the results of the WM_QUERYENDSESSION message.
WM_QUERYNEWPALETTE 0x30F This message informs a window that it is about to receive the keyboard focus, giving the window the opportunity to realize its logical palette when it receives the focus.
WM_QUERYOPEN 0x13 The WM_QUERYOPEN message is sent to an icon when the user requests that the window be restored to its previous size and position.
WM_QUEUESYNC 0x23 The WM_QUEUESYNC message is sent by a computer-based training (CBT) application to separate user-input messages from other messages sent through the WH_JOURNALPLAYBACK Hook procedure.
WM_QUIT 0x12 Once received, it ends the application's Message Loop, signaling the application to end. It can be sent by pressing Alt+F4, Clicking the X in the upper right-hand of the program, or going to File->Exit.
WM_RBUTTONDBLCLK 0x206 he WM_RBUTTONDBLCLK message is posted when the user double-clicks the right mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
WM_RBUTTONDOWN 0x204 The WM_RBUTTONDOWN message is posted when the user presses the right mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
WM_RBUTTONUP 0x205 The WM_RBUTTONUP message is posted when the user releases the right mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
WM_RENDERALLFORMATS 0x306 The WM_RENDERALLFORMATS message is sent to the clipboard owner before it is destroyed, if the clipboard owner has delayed rendering one or more clipboard formats. For the content of the clipboard to remain available to other applications, the clipboard owner must render data in all the formats it is capable of generating, and place the data on the clipboard by calling the SetClipboardData function.
WM_RENDERFORMAT 0x305 The WM_RENDERFORMAT message is sent to the clipboard owner if it has delayed rendering a specific clipboard format and if an application has requested data in that format. The clipboard owner must render data in the specified format and place it on the clipboard by calling the SetClipboardData function.
WM_SETCURSOR 0x20 The WM_SETCURSOR message is sent to a window if the mouse causes the cursor to move within a window and mouse input is not captured.
WM_SETFOCUS 0x7 When the controll got the focus
WM_SETFONT 0x30 An application sends a WM_SETFONT message to specify the font that a control is to use when drawing text.
WM_SETHOTKEY 0x32 An application sends a WM_SETHOTKEY message to a window to associate a hot key with the window. When the user presses the hot key, the system activates the window.
WM_SETICON 0x80 An application sends the WM_SETICON message to associate a new large or small icon with a window. The system displays the large icon in the ALT+TAB dialog box, and the small icon in the window caption.
WM_SETREDRAW 0xB An application sends the WM_SETREDRAW message to a window to allow changes in that window to be redrawn or to prevent changes in that window from being redrawn.
WM_SETTEXT 0xC Text / Caption changed on the control. An application sends a WM_SETTEXT message to set the text of a window.
WM_SETTINGCHANGE 0x1A An application sends the WM_SETTINGCHANGE message to all top-level windows after making a change to the WIN.INI file. The SystemParametersInfo function sends this message after an application uses the function to change a setting in WIN.INI.
WM_SHOWWINDOW 0x18 The WM_SHOWWINDOW message is sent to a window when the window is about to be hidden or shown
WM_SIZE 0x5 The WM_SIZE message is sent to a window after its size has changed.
WM_SIZECLIPBOARD 0x30B The WM_SIZECLIPBOARD message is sent to the clipboard owner by a clipboard viewer window when the clipboard contains data in the CF_OWNERDISPLAY format and the clipboard viewer's client area has changed size.
WM_SIZING 0x214 The WM_SIZING message is sent to a window that the user is resizing. By processing this message, an application can monitor the size and position of the drag rectangle and, if needed, change its size or position.
WM_SPOOLERSTATUS 0x2A The WM_SPOOLERSTATUS message is sent from Print Manager whenever a job is added to or removed from the Print Manager queue.
WM_STYLECHANGED 0x7D The WM_STYLECHANGED message is sent to a window after the SetWindowLong function has changed one or more of the window's styles.
WM_STYLECHANGING 0x7C The WM_STYLECHANGING message is sent to a window when the SetWindowLong function is about to change one or more of the window's styles.
WM_SYNCPAINT 0x88 The WM_SYNCPAINT message is used to synchronize painting while avoiding linking independent GUI threads.
WM_SYSCHAR 0x106 The WM_SYSCHAR message is posted to the window with the keyboard focus when a WM_SYSKEYDOWN message is translated by the TranslateMessage function. It specifies the character code of a system character key — that is, a character key that is pressed while the ALT key is down.
WM_SYSCOLORCHANGE 0x15 This message is sent to all top-level windows when a change is made to a system color setting.
WM_SYSCOMMAND 0x112 A window receives this message when the user chooses a command from the Window menu (formerly known as the system or control menu) or when the user chooses the maximize button, minimize button, restore button, or close button.
WM_SYSDEADCHAR 0x107 The WM_SYSDEADCHAR message is sent to the window with the keyboard focus when a WM_SYSKEYDOWN message is translated by the TranslateMessage function. WM_SYSDEADCHAR specifies the character code of a system dead key — that is, a dead key that is pressed while holding down the ALT key.
WM_SYSKEYDOWN 0x104 The WM_SYSKEYDOWN message is posted to the window with the keyboard focus when the user presses the F10 key (which activates the menu bar) or holds down the ALT key and then presses another key. It also occurs when no window currently has the keyboard focus; in this case, the WM_SYSKEYDOWN message is sent to the active window. The window that receives the message can distinguish between these two contexts by checking the context code in the lParam parameter.
WM_SYSKEYUP 0x105 The WM_SYSKEYUP message is posted to the window with the keyboard focus when the user releases a key that was pressed while the ALT key was held down. It also occurs when no window currently has the keyboard focus; in this case, the WM_SYSKEYUP message is sent to the active window. The window that receives the message can distinguish between these two contexts by checking the context code in the lParam parameter.
WM_TCARD 0x52 Sent to an application that has initiated a training card with Microsoft Windows Help. The message informs the application when the user clicks an authorable button. An application initiates a training card by specifying the HELP_TCARD command in a call to the WinHelp function.
WM_TIMECHANGE 0x1E A message that is sent whenever there is a change in the system time.
WM_TIMER 0x113 The WM_TIMER message is posted to the installing thread's message queue when a timer expires. The message is posted by the GetMessage or PeekMessage function.
WM_UNDO 0x304 An application sends a WM_UNDO message to an edit control to undo the last operation. When this message is sent to an edit control, the previously deleted text is restored or the previously added text is deleted.
WM_UNINITMENUPOPUP 0x125 The WM_UNINITMENUPOPUP message is sent when a drop-down menu or submenu has been destroyed.
WM_USER 0x400 The WM_USER constant is used by applications to help define private messages for use by private window classes, usually of the form WM_USER+X, where X is an integer value.
WM_USERCHANGED 0x54 The WM_USERCHANGED message is sent to all windows after the user has logged on or off. When the user logs on or off, the system updates the user-specific settings. The system sends this message immediately after updating the settings.
WM_VKEYTOITEM 0x2E Sent by a list box with the LBS_WANTKEYBOARDINPUT style to its owner in response to a WM_KEYDOWN message.
WM_VSCROLL 0x115 The WM_VSCROLL message is sent to a window when a scroll event occurs in the window's standard vertical scroll bar. This message is also sent to the owner of a vertical scroll bar control when a scroll event occurs in the control.
WM_VSCROLLCLIPBOARD 0x30A The WM_VSCROLLCLIPBOARD message is sent to the clipboard owner by a clipboard viewer window when the clipboard contains data in the CF_OWNERDISPLAY format and an event occurs in the clipboard viewer's vertical scroll bar. The owner should scroll the clipboard image and update the scroll bar values.
WM_WINDOWPOSCHANGED 0x47 The WM_WINDOWPOSCHANGED message is sent to a window whose size, position, or place in the Z order has changed as a result of a call to the SetWindowPos function or another window-management function.
WM_WINDOWPOSCHANGING 0x46 The WM_WINDOWPOSCHANGING message is sent to a window whose size, position, or place in the Z order is about to change as a result of a call to the SetWindowPos function or another window-management function.
WM_WININICHANGE 0x1A An application sends the WM_WININICHANGE message to all top-level windows after making a change to the WIN.INI file. The SystemParametersInfo function sends this message after an application uses the function to change a setting in WIN.INI. Note The WM_WININICHANGE message is provided only for compatibility with earlier versions of the system. Applications should use the WM_SETTINGCHANGE message.
WM_XBUTTONDBLCLK 0x20D The WM_XBUTTONDBLCLK message is posted when the user double-clicks the first or second X button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
WM_XBUTTONDOWN 0x20B The WM_XBUTTONDOWN message is posted when the user presses the first or second X button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
WM_XBUTTONUP 0x20C The WM_XBUTTONUP message is posted when the user releases the first or second X button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.

C# Constants:

private const UInt32 WM_ACTIVATE           = 0x0006;
private const UInt32 WM_ACTIVATEAPP        = 0x001C;
private const UInt32 WM_AFXFIRST           = 0x0360;
private const UInt32 WM_AFXLAST        = 0x037F;
private const UInt32 WM_APP            = 0x8000;
private const UInt32 WM_ASKCBFORMATNAME    = 0x030C;
private const UInt32 WM_CANCELJOURNAL      = 0x004B;
private const UInt32 WM_CANCELMODE         = 0x001F;
private const UInt32 WM_CAPTURECHANGED     = 0x0215;
private const UInt32 WM_CHANGECBCHAIN      = 0x030D;
private const UInt32 WM_CHANGEUISTATE      = 0x0127;
private const UInt32 WM_CHAR           = 0x0102;
private const UInt32 WM_CHARTOITEM         = 0x002F;
private const UInt32 WM_CHILDACTIVATE      = 0x0022;
private const UInt32 WM_CLEAR          = 0x0303;
private const UInt32 WM_CLOSE          = 0x0010;
private const UInt32 WM_COMMAND        = 0x0111;
private const UInt32 WM_COMPACTING         = 0x0041;
private const UInt32 WM_COMPAREITEM        = 0x0039;
private const UInt32 WM_CONTEXTMENU        = 0x007B;
private const UInt32 WM_COPY           = 0x0301;
private const UInt32 WM_COPYDATA           = 0x004A;
private const UInt32 WM_CREATE         = 0x0001;
private const UInt32 WM_CTLCOLORBTN        = 0x0135;
private const UInt32 WM_CTLCOLORDLG        = 0x0136;
private const UInt32 WM_CTLCOLOREDIT       = 0x0133;
private const UInt32 WM_CTLCOLORLISTBOX    = 0x0134;
private const UInt32 WM_CTLCOLORMSGBOX     = 0x0132;
private const UInt32 WM_CTLCOLORSCROLLBAR      = 0x0137;
private const UInt32 WM_CTLCOLORSTATIC     = 0x0138;
private const UInt32 WM_CUT            = 0x0300;
private const UInt32 WM_DEADCHAR           = 0x0103;
private const UInt32 WM_DELETEITEM         = 0x002D;
private const UInt32 WM_DESTROY        = 0x0002;
private const UInt32 WM_DESTROYCLIPBOARD       = 0x0307;
private const UInt32 WM_DEVICECHANGE       = 0x0219;
private const UInt32 WM_DEVMODECHANGE      = 0x001B;
private const UInt32 WM_DISPLAYCHANGE      = 0x007E;
private const UInt32 WM_DRAWCLIPBOARD      = 0x0308;
private const UInt32 WM_DRAWITEM           = 0x002B;
private const UInt32 WM_DROPFILES          = 0x0233;
private const UInt32 WM_ENABLE         = 0x000A;
private const UInt32 WM_ENDSESSION         = 0x0016;
private const UInt32 WM_ENTERIDLE          = 0x0121;
private const UInt32 WM_ENTERMENULOOP      = 0x0211;
private const UInt32 WM_ENTERSIZEMOVE      = 0x0231;
private const UInt32 WM_ERASEBKGND         = 0x0014;
private const UInt32 WM_EXITMENULOOP       = 0x0212;
private const UInt32 WM_EXITSIZEMOVE       = 0x0232;
private const UInt32 WM_FONTCHANGE         = 0x001D;
private const UInt32 WM_GETDLGCODE         = 0x0087;
private const UInt32 WM_GETFONT        = 0x0031;
private const UInt32 WM_GETHOTKEY          = 0x0033;
private const UInt32 WM_GETICON        = 0x007F;
private const UInt32 WM_GETMINMAXINFO      = 0x0024;
private const UInt32 WM_GETOBJECT          = 0x003D;
private const UInt32 WM_GETTEXT        = 0x000D;
private const UInt32 WM_GETTEXTLENGTH      = 0x000E;
private const UInt32 WM_HANDHELDFIRST      = 0x0358;
private const UInt32 WM_HANDHELDLAST       = 0x035F;
private const UInt32 WM_HELP           = 0x0053;
private const UInt32 WM_HOTKEY         = 0x0312;
private const UInt32 WM_HSCROLL        = 0x0114;
private const UInt32 WM_HSCROLLCLIPBOARD       = 0x030E;
private const UInt32 WM_ICONERASEBKGND     = 0x0027;
private const UInt32 WM_IME_CHAR           = 0x0286;
private const UInt32 WM_IME_COMPOSITION    = 0x010F;
private const UInt32 WM_IME_COMPOSITIONFULL    = 0x0284;
private const UInt32 WM_IME_CONTROL        = 0x0283;
private const UInt32 WM_IME_ENDCOMPOSITION     = 0x010E;
private const UInt32 WM_IME_KEYDOWN        = 0x0290;
private const UInt32 WM_IME_KEYLAST        = 0x010F;
private const UInt32 WM_IME_KEYUP          = 0x0291;
private const UInt32 WM_IME_NOTIFY         = 0x0282;
private const UInt32 WM_IME_REQUEST        = 0x0288;
private const UInt32 WM_IME_SELECT         = 0x0285;
private const UInt32 WM_IME_SETCONTEXT     = 0x0281;
private const UInt32 WM_IME_STARTCOMPOSITION   = 0x010D;
private const UInt32 WM_INITDIALOG         = 0x0110;
private const UInt32 WM_INITMENU           = 0x0116;
private const UInt32 WM_INITMENUPOPUP      = 0x0117;
private const UInt32 WM_INPUTLANGCHANGE    = 0x0051;
private const UInt32 WM_INPUTLANGCHANGEREQUEST = 0x0050;
private const UInt32 WM_KEYDOWN        = 0x0100;
private const UInt32 WM_KEYFIRST           = 0x0100;
private const UInt32 WM_KEYLAST        = 0x0108;
private const UInt32 WM_KEYUP          = 0x0101;
private const UInt32 WM_KILLFOCUS          = 0x0008;
private const UInt32 WM_LBUTTONDBLCLK      = 0x0203;
private const UInt32 WM_LBUTTONDOWN        = 0x0201;
private const UInt32 WM_LBUTTONUP          = 0x0202;
private const UInt32 WM_MBUTTONDBLCLK      = 0x0209;
private const UInt32 WM_MBUTTONDOWN        = 0x0207;
private const UInt32 WM_MBUTTONUP          = 0x0208;
private const UInt32 WM_MDIACTIVATE        = 0x0222;
private const UInt32 WM_MDICASCADE         = 0x0227;
private const UInt32 WM_MDICREATE          = 0x0220;
private const UInt32 WM_MDIDESTROY         = 0x0221;
private const UInt32 WM_MDIGETACTIVE       = 0x0229;
private const UInt32 WM_MDIICONARRANGE     = 0x0228;
private const UInt32 WM_MDIMAXIMIZE        = 0x0225;
private const UInt32 WM_MDINEXT        = 0x0224;
private const UInt32 WM_MDIREFRESHMENU     = 0x0234;
private const UInt32 WM_MDIRESTORE         = 0x0223;
private const UInt32 WM_MDISETMENU         = 0x0230;
private const UInt32 WM_MDITILE        = 0x0226;
private const UInt32 WM_MEASUREITEM        = 0x002C;
private const UInt32 WM_MENUCHAR           = 0x0120;
private const UInt32 WM_MENUCOMMAND        = 0x0126;
private const UInt32 WM_MENUDRAG           = 0x0123;
private const UInt32 WM_MENUGETOBJECT      = 0x0124;
private const UInt32 WM_MENURBUTTONUP      = 0x0122;
private const UInt32 WM_MENUSELECT         = 0x011F;
private const UInt32 WM_MOUSEACTIVATE      = 0x0021;
private const UInt32 WM_MOUSEFIRST         = 0x0200;
private const UInt32 WM_MOUSEHOVER         = 0x02A1;
private const UInt32 WM_MOUSELAST          = 0x020D;
private const UInt32 WM_MOUSELEAVE         = 0x02A3;
private const UInt32 WM_MOUSEMOVE          = 0x0200;
private const UInt32 WM_MOUSEWHEEL         = 0x020A;
private const UInt32 WM_MOUSEHWHEEL        = 0x020E;
private const UInt32 WM_MOVE           = 0x0003;
private const UInt32 WM_MOVING         = 0x0216;
private const UInt32 WM_NCACTIVATE         = 0x0086;
private const UInt32 WM_NCCALCSIZE         = 0x0083;
private const UInt32 WM_NCCREATE           = 0x0081;
private const UInt32 WM_NCDESTROY          = 0x0082;
private const UInt32 WM_NCHITTEST          = 0x0084;
private const UInt32 WM_NCLBUTTONDBLCLK    = 0x00A3;
private const UInt32 WM_NCLBUTTONDOWN      = 0x00A1;
private const UInt32 WM_NCLBUTTONUP        = 0x00A2;
private const UInt32 WM_NCMBUTTONDBLCLK    = 0x00A9;
private const UInt32 WM_NCMBUTTONDOWN      = 0x00A7;
private const UInt32 WM_NCMBUTTONUP        = 0x00A8;
private const UInt32 WM_NCMOUSEMOVE        = 0x00A0;
private const UInt32 WM_NCPAINT        = 0x0085;
private const UInt32 WM_NCRBUTTONDBLCLK    = 0x00A6;
private const UInt32 WM_NCRBUTTONDOWN      = 0x00A4;
private const UInt32 WM_NCRBUTTONUP        = 0x00A5;
private const UInt32 WM_NCUAHDRAWCAPTION       = 0x00AE;
private const UInt32 WM_NCUAHDRAWFRAME     = 0x00AF;
private const UInt32 WM_NEXTDLGCTL         = 0x0028;
private const UInt32 WM_NEXTMENU           = 0x0213;
private const UInt32 WM_NOTIFY         = 0x004E;
private const UInt32 WM_NOTIFYFORMAT       = 0x0055;
private const UInt32 WM_NULL           = 0x0000;
private const UInt32 WM_PAINT          = 0x000F;
private const UInt32 WM_PAINTCLIPBOARD     = 0x0309;
private const UInt32 WM_PAINTICON          = 0x0026;
private const UInt32 WM_PALETTECHANGED     = 0x0311;
private const UInt32 WM_PALETTEISCHANGING      = 0x0310;
private const UInt32 WM_PARENTNOTIFY       = 0x0210;
private const UInt32 WM_PASTE          = 0x0302;
private const UInt32 WM_PENWINFIRST        = 0x0380;
private const UInt32 WM_PENWINLAST         = 0x038F;
private const UInt32 WM_POWER          = 0x0048;
private const UInt32 WM_POWERBROADCAST     = 0x0218;
private const UInt32 WM_PRINT          = 0x0317;
private const UInt32 WM_PRINTCLIENT        = 0x0318;
private const UInt32 WM_QUERYDRAGICON      = 0x0037;
private const UInt32 WM_QUERYENDSESSION    = 0x0011;
private const UInt32 WM_QUERYNEWPALETTE    = 0x030F;
private const UInt32 WM_QUERYOPEN          = 0x0013;
private const UInt32 WM_QUEUESYNC          = 0x0023;
private const UInt32 WM_QUIT           = 0x0012;
private const UInt32 WM_RBUTTONDBLCLK      = 0x0206;
private const UInt32 WM_RBUTTONDOWN        = 0x0204;
private const UInt32 WM_RBUTTONUP          = 0x0205;
private const UInt32 WM_RENDERALLFORMATS       = 0x0306;
private const UInt32 WM_RENDERFORMAT       = 0x0305;
private const UInt32 WM_SETCURSOR          = 0x0020;
private const UInt32 WM_SETFOCUS           = 0x0007;
private const UInt32 WM_SETFONT        = 0x0030;
private const UInt32 WM_SETHOTKEY          = 0x0032;
private const UInt32 WM_SETICON        = 0x0080;
private const UInt32 WM_SETREDRAW          = 0x000B;
private const UInt32 WM_SETTEXT        = 0x000C;
private const UInt32 WM_SETTINGCHANGE      = 0x001A;
private const UInt32 WM_SHOWWINDOW         = 0x0018;
private const UInt32 WM_SIZE           = 0x0005;
private const UInt32 WM_SIZECLIPBOARD      = 0x030B;
private const UInt32 WM_SIZING         = 0x0214;
private const UInt32 WM_SPOOLERSTATUS      = 0x002A;
private const UInt32 WM_STYLECHANGED       = 0x007D;
private const UInt32 WM_STYLECHANGING      = 0x007C;
private const UInt32 WM_SYNCPAINT          = 0x0088;
private const UInt32 WM_SYSCHAR        = 0x0106;
private const UInt32 WM_SYSCOLORCHANGE     = 0x0015;
private const UInt32 WM_SYSCOMMAND         = 0x0112;
private const UInt32 WM_SYSDEADCHAR        = 0x0107;
private const UInt32 WM_SYSKEYDOWN         = 0x0104;
private const UInt32 WM_SYSKEYUP           = 0x0105;
private const UInt32 WM_TCARD          = 0x0052;
private const UInt32 WM_TIMECHANGE         = 0x001E;
private const UInt32 WM_TIMER          = 0x0113;
private const UInt32 WM_UNDO           = 0x0304;
private const UInt32 WM_UNINITMENUPOPUP    = 0x0125;
private const UInt32 WM_USER           = 0x0400;
private const UInt32 WM_USERCHANGED        = 0x0054;
private const UInt32 WM_VKEYTOITEM         = 0x002E;
private const UInt32 WM_VSCROLL        = 0x0115;
private const UInt32 WM_VSCROLLCLIPBOARD       = 0x030A;
private const UInt32 WM_WINDOWPOSCHANGED       = 0x0047;
private const UInt32 WM_WINDOWPOSCHANGING      = 0x0046;
private const UInt32 WM_WININICHANGE       = 0x001A;
private const UInt32 WM_XBUTTONDBLCLK      = 0x020D;
private const UInt32 WM_XBUTTONDOWN        = 0x020B;
private const UInt32 WM_XBUTTONUP          = 0x020C;

VB Constants:

Public Enum WndMsg
   WM_ACTIVATE = &H6
   WM_ACTIVATEAPP = &H1C
   WM_AFXFIRST = &H360
   WM_AFXLAST = &H37F
   WM_APP = &H8000
   WM_ASKCBFORMATNAME = &H30C
   WM_CANCELJOURNAL = &H4B
   WM_CANCELMODE = &H1F
   WM_CAPTURECHANGED = &H215
   WM_CHANGECBCHAIN = &H30D
   WM_CHANGEUISTATE = &H127
   WM_CHAR = &H102
   WM_CHARTOITEM = &H2F
   WM_CHILDACTIVATE = &H22
   WM_CLEAR = &H303
   WM_CLOSE = &H10
   WM_COMMAND = &H111
   WM_COMPACTING = &H41
   WM_COMPAREITEM = &H39
   WM_CONTEXTMENU = &H7B
   WM_COPY = &H301
   WM_COPYDATA = &H4A
   WM_CREATE = &H1
   WM_CTLCOLORBTN = &H135
   WM_CTLCOLORDLG = &H136
   WM_CTLCOLOREDIT = &H133
   WM_CTLCOLORLISTBOX = &H134
   WM_CTLCOLORMSGBOX = &H132
   WM_CTLCOLORSCROLLBAR = &H137
   WM_CTLCOLORSTATIC = &H138
   WM_CUT = &H300
   WM_DEADCHAR = &H103
   WM_DELETEITEM = &H2D
   WM_DESTROY = &H2
   WM_DESTROYCLIPBOARD = &H307
   WM_DEVICECHANGE = &H219
   WM_DEVMODECHANGE = &H1B
   WM_DISPLAYCHANGE = &H7E
   WM_DRAWCLIPBOARD = &H308
   WM_DRAWITEM = &H2B
   WM_DROPFILES = &H233
   WM_ENABLE = &HA
   WM_ENDSESSION = &H16
   WM_ENTERIDLE = &H121
   WM_ENTERMENULOOP = &H211
   WM_ENTERSIZEMOVE = &H231
   WM_ERASEBKGND = &H14
   WM_EXITMENULOOP = &H212
   WM_EXITSIZEMOVE = &H232
   WM_FONTCHANGE = &H1D
   WM_GETDLGCODE = &H87
   WM_GETFONT = &H31
   WM_GETHOTKEY = &H33
   WM_GETICON = &H7F
   WM_GETMINMAXINFO = &H24
   WM_GETOBJECT = &H3D
   WM_GETTEXT = &HD
   WM_GETTEXTLENGTH = &HE
   WM_HANDHELDFIRST = &H358
   WM_HANDHELDLAST = &H35F
   WM_HELP = &H53
   WM_HOTKEY = &H312
   WM_HSCROLL = &H114
   WM_HSCROLLCLIPBOARD = &H30E
   WM_ICONERASEBKGND = &H27
   WM_IME_CHAR = &H286
   WM_IME_COMPOSITION = &H10F
   WM_IME_COMPOSITIONFULL = &H284
   WM_IME_CONTROL = &H283
   WM_IME_ENDCOMPOSITION = &H10E
   WM_IME_KEYDOWN = &H290
   WM_IME_KEYLAST = &H10F
   WM_IME_KEYUP = &H291
   WM_IME_NOTIFY = &H282
   WM_IME_REQUEST = &H288
   WM_IME_SELECT = &H285
   WM_IME_SETCONTEXT = &H281
   WM_IME_STARTCOMPOSITION = &H10D
   WM_INITDIALOG = &H110
   WM_INITMENU = &H116
   WM_INITMENUPOPUP = &H117
   WM_INPUTLANGCHANGE = &H51
   WM_INPUTLANGCHANGEREQUEST = &H50
   WM_KEYDOWN = &H100
   WM_KEYFIRST = &H100
   WM_KEYLAST = &H108
   WM_KEYUP = &H101
   WM_KILLFOCUS = &H8
   WM_LBUTTONDBLCLK = &H203
   WM_LBUTTONDOWN = &H201
   WM_LBUTTONUP = &H202
   WM_MBUTTONDBLCLK = &H209
   WM_MBUTTONDOWN = &H207
   WM_MBUTTONUP = &H208
   WM_MDIACTIVATE = &H222
   WM_MDICASCADE = &H227
   WM_MDICREATE = &H220
   WM_MDIDESTROY = &H221
   WM_MDIGETACTIVE = &H229
   WM_MDIICONARRANGE = &H228
   WM_MDIMAXIMIZE = &H225
   WM_MDINEXT = &H224
   WM_MDIREFRESHMENU = &H234
   WM_MDIRESTORE = &H223
   WM_MDISETMENU = &H230
   WM_MDITILE = &H226
   WM_MEASUREITEM = &H2C
   WM_MENUCHAR = &H120
   WM_MENUCOMMAND = &H126
   WM_MENUDRAG = &H123
   WM_MENUGETOBJECT = &H124
   WM_MENURBUTTONUP = &H122
   WM_MENUSELECT = &H11F
   WM_MOUSEACTIVATE = &H21
   WM_MOUSEFIRST = &H200
   WM_MOUSEHOVER = &H2A1
   WM_MOUSELAST = &H20D
   WM_MOUSELEAVE = &H2A3
   WM_MOUSEMOVE = &H200
   WM_MOUSEWHEEL = &H20A
   WM_MOUSEHWHEEL = &H20E
   WM_MOVE = &H3
   WM_MOVING = &H216
   WM_NCACTIVATE = &H86
   WM_NCCALCSIZE = &H83
   WM_NCCREATE = &H81
   WM_NCDESTROY = &H82
   WM_NCHITTEST = &H84
   WM_NCLBUTTONDBLCLK = &HA3
   WM_NCLBUTTONDOWN = &HA1
   WM_NCLBUTTONUP = &HA2
   WM_NCMBUTTONDBLCLK = &HA9
   WM_NCMBUTTONDOWN = &HA7
   WM_NCMBUTTONUP = &HA8
   WM_NCMOUSEMOVE = &HA0
   WM_NCPAINT = &H85
   WM_NCRBUTTONDBLCLK = &HA6
   WM_NCRBUTTONDOWN = &HA4
   WM_NCRBUTTONUP = &HA5
   WM_NCUAHDRAWCAPTION = &HAE
   WM_NCUAHDRAWFRAME = &HAF
   WM_NEXTDLGCTL = &H28
   WM_NEXTMENU = &H213
   WM_NOTIFY = &H4E
   WM_NOTIFYFORMAT = &H55
   WM_NULL = &H0
   WM_PAINT = &HF
   WM_PAINTCLIPBOARD = &H309
   WM_PAINTICON = &H26
   WM_PALETTECHANGED = &H311
   WM_PALETTEISCHANGING = &H310
   WM_PARENTNOTIFY = &H210
   WM_PASTE = &H302
   WM_PENWINFIRST = &H380
   WM_PENWINLAST = &H38F
   WM_POWER = &H48
   WM_POWERBROADCAST = &H218
   WM_PRINT = &H317
   WM_PRINTCLIENT = &H318
   WM_QUERYDRAGICON = &H37
   WM_QUERYENDSESSION = &H11
   WM_QUERYNEWPALETTE = &H30F
   WM_QUERYOPEN = &H13
   WM_QUEUESYNC = &H23
   WM_QUIT = &H12
   WM_RBUTTONDBLCLK = &H206
   WM_RBUTTONDOWN = &H204
   WM_RBUTTONUP = &H205
   WM_RENDERALLFORMATS = &H306
   WM_RENDERFORMAT = &H305
   WM_SETCURSOR = &H20
   WM_SETFOCUS = &H7
   WM_SETFONT = &H30
   WM_SETHOTKEY = &H32
   WM_SETICON = &H80
   WM_SETREDRAW = &HB
   WM_SETTEXT = &HC
   WM_SETTINGCHANGE = &H1A
   WM_SHOWWINDOW = &H18
   WM_SIZE = &H5
   WM_SIZECLIPBOARD = &H30B
   WM_SIZING = &H214
   WM_SPOOLERSTATUS = &H2A
   WM_STYLECHANGED = &H7D
   WM_STYLECHANGING = &H7C
   WM_SYNCPAINT = &H88
   WM_SYSCHAR = &H106
   WM_SYSCOLORCHANGE = &H15
   WM_SYSCOMMAND = &H112
   WM_SYSDEADCHAR = &H107
   WM_SYSKEYDOWN = &H104
   WM_SYSKEYUP = &H105
   WM_TCARD = &H52
   WM_TIMECHANGE = &H1E
   WM_TIMER = &H113
   WM_UNDO = &H304
   WM_UNINITMENUPOPUP = &H125
   WM_USER = &H400
   WM_USERCHANGED = &H54
   WM_VKEYTOITEM = &H2E
   WM_VSCROLL = &H115
   WM_VSCROLLCLIPBOARD = &H30A
   WM_WINDOWPOSCHANGED = &H47
   WM_WINDOWPOSCHANGING = &H46
   WM_WININICHANGE = &H1A
   WM_XBUTTONDBLCLK = &H20D
   WM_XBUTTONDOWN = &H20B
   WM_XBUTTONUP = &H20C
End Enum

Masm constants in numeric order:

WM_NULL           equ 000h
WM_CREATE         equ 001h
WM_DESTROY        equ 002h
WM_MOVE           equ 003h
WM_SIZE           equ 005h
WM_ACTIVATE           equ 006h
WM_SETFOCUS           equ 007h
WM_KILLFOCUS          equ 008h
WM_ENABLE         equ 00Ah
WM_SETREDRAW          equ 00Bh
WM_SETTEXT        equ 00Ch
WM_GETTEXT        equ 00Dh
WM_GETTEXTLENGTH      equ 00Eh
WM_PAINT          equ 00Fh
WM_CLOSE          equ 010h
WM_QUERYENDSESSION    equ 011h
WM_QUIT           equ 012h
WM_QUERYOPEN          equ 013h
WM_ERASEBKGND         equ 014h
WM_SYSCOLORCHANGE     equ 015h
WM_ENDSESSION         equ 016h
WM_SHOWWINDOW         equ 018h
WM_SETTINGCHANGE      equ 01Ah
WM_WININICHANGE       equ 01Ah
WM_DEVMODECHANGE      equ 01Bh
WM_ACTIVATEAPP        equ 01Ch
WM_FONTCHANGE         equ 01Dh
WM_TIMECHANGE         equ 01Eh
WM_CANCELMODE         equ 01Fh
WM_SETCURSOR          equ 020h
WM_MOUSEACTIVATE      equ 021h
WM_CHILDACTIVATE      equ 022h
WM_QUEUESYNC          equ 023h
WM_GETMINMAXINFO      equ 024h
WM_PAINTICON          equ 026h
WM_ICONERASEBKGND     equ 027h
WM_NEXTDLGCTL         equ 028h
WM_SPOOLERSTATUS      equ 02Ah
WM_DRAWITEM           equ 02Bh
WM_MEASUREITEM        equ 02Ch
WM_DELETEITEM         equ 02Dh
WM_VKEYTOITEM         equ 02Eh
WM_CHARTOITEM         equ 02Fh
WM_SETFONT        equ 030h
WM_GETFONT        equ 031h
WM_SETHOTKEY          equ 032h
WM_GETHOTKEY          equ 033h
WM_QUERYDRAGICON      equ 037h
WM_COMPAREITEM        equ 039h
WM_GETOBJECT          equ 03Dh
WM_COMPACTING         equ 041h
WM_OTHERWINDOWCREATED     equ 042h
WM_OTHERWINDOWDESTROYED   equ 043h
WM_COMMNOTIFY         equ 044h
WM_WINDOWPOSCHANGING      equ 046h
WM_WINDOWPOSCHANGED       equ 047h
WM_POWER          equ 048h
WM_COPYDATA           equ 04Ah
WM_CANCELJOURNAL      equ 04Bh
WM_NOTIFY         equ 04Eh
WM_INPUTLANGCHANGEREQUEST equ 050h
WM_INPUTLANGCHANGE    equ 051h
WM_TCARD          equ 052h
WM_HELP           equ 053h
WM_USERCHANGED        equ 054h
WM_NOTIFYFORMAT       equ 055h
WM_CONTEXTMENU        equ 07Bh
WM_STYLECHANGING      equ 07Ch
WM_STYLECHANGED       equ 07Dh
WM_DISPLAYCHANGE      equ 07Eh
WM_GETICON        equ 07Fh
WM_SETICON        equ 080h
WM_NCCREATE           equ 081h
WM_NCDESTROY          equ 082h
WM_NCCALCSIZE         equ 083h
WM_NCHITTEST          equ 084h
WM_NCPAINT        equ 085h
WM_NCACTIVATE         equ 086h
WM_GETDLGCODE         equ 087h
WM_SYNCPAINT          equ 088h
WM_NCMOUSEMOVE        equ 0A0h
WM_NCLBUTTONDOWN      equ 0A1h
WM_NCLBUTTONUP        equ 0A2h
WM_NCLBUTTONDBLCLK    equ 0A3h
WM_NCRBUTTONDOWN      equ 0A4h
WM_NCRBUTTONUP        equ 0A5h
WM_NCRBUTTONDBLCLK    equ 0A6h
WM_NCMBUTTONDOWN      equ 0A7h
WM_NCMBUTTONUP        equ 0A8h
WM_NCMBUTTONDBLCLK    equ 0A9h
WM_NCXBUTTONDOWN      equ 0ABh
WM_NCXBUTTONUP        equ 0ACh
WM_NCXBUTTONDBLCLK    equ 0ADh
WM_NCUAHDRAWCAPTION       equ 0AEh
WM_NCUAHDRAWFRAME     equ 0AFh
WM_KEYFIRST           equ 100h
WM_KEYDOWN        equ 100h
WM_KEYUP          equ 101h
WM_CHAR           equ 102h
WM_DEADCHAR           equ 103h
WM_SYSKEYDOWN         equ 104h
WM_SYSKEYUP           equ 105h
WM_SYSCHAR        equ 106h
WM_SYSDEADCHAR        equ 107h
WM_KEYLAST        equ 108h
WM_UNICHAR        equ 109h
WM_IME_STARTCOMPOSITION   equ 10Dh
WM_IME_ENDCOMPOSITION     equ 10Eh
WM_IME_COMPOSITION    equ 10Fh
WM_IME_KEYLAST        equ 10Fh
WM_INITDIALOG         equ 110h
WM_COMMAND        equ 111h
WM_SYSCOMMAND         equ 112h
WM_TIMER          equ 113h
WM_HSCROLL        equ 114h
WM_VSCROLL        equ 115h
WM_INITMENU           equ 116h
WM_INITMENUPOPUP      equ 117h
WM_MENUSELECT         equ 11Fh
WM_MENUCHAR           equ 120h
WM_ENTERIDLE          equ 121h
WM_MENURBUTTONUP      equ 122h
WM_MENUDRAG           equ 123h
WM_MENUGETOBJECT      equ 124h
WM_UNINITMENUPOPUP    equ 125h
WM_MENUCOMMAND        equ 126h
WM_CHANGEUISTATE      equ 127h
WM_UPDATEUISTATE      equ 128h
WM_QUERYUISTATE       equ 129h
WM_CTLCOLORMSGBOX     equ 132h
WM_CTLCOLOREDIT       equ 133h
WM_CTLCOLORLISTBOX    equ 134h
WM_CTLCOLORBTN        equ 135h
WM_CTLCOLORDLG        equ 136h
WM_CTLCOLORSCROLLBAR      equ 137h
WM_CTLCOLORSTATIC     equ 138h
WM_MOUSEFIRST         equ 200h
WM_MOUSEMOVE          equ 200h
WM_LBUTTONDOWN        equ 201h
WM_LBUTTONUP          equ 202h
WM_LBUTTONDBLCLK      equ 203h
WM_RBUTTONDOWN        equ 204h
WM_RBUTTONUP          equ 205h
WM_RBUTTONDBLCLK      equ 206h
WM_MBUTTONDOWN        equ 207h
WM_MBUTTONUP          equ 208h
WM_MOUSELAST          equ 209h
WM_MBUTTONDBLCLK      equ 209h
WM_MOUSEWHEEL         equ 20Ah
WM_MOUSEHWHEEL        equ 20Eh
WM_XBUTTONDOWN        equ 20Bh
WM_XBUTTONUP          equ 20Ch
WM_XBUTTONDBLCLK      equ 20Dh
WM_PARENTNOTIFY       equ 210h
WM_ENTERMENULOOP      equ 211h
WM_EXITMENULOOP       equ 212h
WM_NEXTMENU           equ 213h
WM_SIZING         equ 214h
WM_CAPTURECHANGED     equ 215h
WM_MOVING         equ 216h
WM_POWERBROADCAST     equ 218h
WM_DEVICECHANGE       equ 219h
WM_MDICREATE          equ 220h
WM_MDIDESTROY         equ 221h
WM_MDIACTIVATE        equ 222h
WM_MDIRESTORE         equ 223h
WM_MDINEXT        equ 224h
WM_MDIMAXIMIZE        equ 225h
WM_MDITILE        equ 226h
WM_MDICASCADE         equ 227h
WM_MDIICONARRANGE     equ 228h
WM_MDIGETACTIVE       equ 229h
WM_MDISETMENU         equ 230h
WM_ENTERSIZEMOVE      equ 231h
WM_EXITSIZEMOVE       equ 232h
WM_DROPFILES          equ 233h
WM_MDIREFRESHMENU     equ 234h
WM_NCMOUSEHOVER       equ 2A0h
WM_MOUSEHOVER         equ 2A1h
WM_IME_SETCONTEXT     equ 281h
WM_IME_NOTIFY         equ 282h
WM_IME_CONTROL        equ 283h
WM_IME_COMPOSITIONFULL    equ 284h
WM_IME_SELECT         equ 285h
WM_IME_CHAR           equ 286h
WM_IME_REQUEST        equ 288h
WM_IME_KEYDOWN        equ 290h
WM_IME_KEYUP          equ 291h
WM_MOUSEHOVER         equ 2A1h
WM_NCMOUSELEAVE       equ 2A2h
WM_MOUSELEAVE         equ 2A3h
WM_WTSSESSION_CHANGE      equ 2B1h
WM_TABLET_FIRST       equ 2c0h
WM_TABLET_LAST        equ 2dfh
WM_CUT            equ 300h
WM_COPY           equ 301h
WM_PASTE          equ 302h
WM_CLEAR          equ 303h
WM_UNDO           equ 304h
WM_RENDERFORMAT       equ 305h
WM_RENDERALLFORMATS       equ 306h
WM_DESTROYCLIPBOARD       equ 307h
WM_DRAWCLIPBOARD      equ 308h
WM_PAINTCLIPBOARD     equ 309h
WM_VSCROLLCLIPBOARD       equ 30Ah
WM_SIZECLIPBOARD      equ 30Bh
WM_ASKCBFORMATNAME    equ 30Ch
WM_CHANGECBCHAIN      equ 30Dh
WM_HSCROLLCLIPBOARD       equ 30Eh
WM_QUERYNEWPALETTE    equ 30Fh
WM_PALETTEISCHANGING      equ 310h
WM_PALETTECHANGED     equ 311h
WM_HOTKEY         equ 312h
WM_PRINT          equ 317h
WM_PRINTCLIENT        equ 318h
WM_APPCOMMAND         equ 319h
WM_THEMECHANGED       equ 31Ah
WM_HANDHELDFIRST      equ 358h
WM_HANDHELDLAST       equ 35Fh
WM_AFXFIRST           equ 360h
WM_AFXLAST        equ 37Fh
WM_PENWINFIRST        equ 380h
WM_PENWINLAST         equ 38Fh
WM_USER           equ 400h

Horizontal Scrolling Support for C++

#ifndef WM_MOUSEHWHEEL
#define WM_MOUSEHWHEEL 0x20E
#endif

2012/10/24

*.bat相關-3

1、@
一般在它之後緊跟一條命令或一條語句,則此命令或語句本身在執行的時候不會顯示在屏幕上。請把下面的代碼保存為test.cmd文件,然後運行,比較一下兩條echo語句在屏幕上的輸出差異:
    echo a
    @pause
    @echo b
    @pause
執行結果如下:
        C:\Documents and Settings\JM\桌面>echo a
        a
        請按任意鍵繼續...
        b
        請按任意鍵繼續...
2、%、%%
百分號用在不同的場合,有不同的含義:
① 當百分號成對出現,並且其間包含非特殊字符時,一般做變量引用處理,比如:%var%、%str%。把以下代碼保存為批處理文件,運行後觀察屏幕顯示結果:
    @echo off
    set str=abc
    echo 變量 str 的值是: %str%
    pause
在屏幕上將顯示這樣的結果:
        變量 str 的值是: abc
        按任意鍵繼續...
另外,百分號作為變量引用還有一種特殊形式,那就是對形式參數的引用,此時,單個百分號後面緊跟0~9這10個數字,如%0、%1,其中,%0為腳本本身的名稱,%1至%9為第二至九個參數...最多支持%0~%9,%10以後就是變量引用了,即%15為%1的值接上5。
請看演示代碼:
    @echo off
    if defined str goto next
    set str=
    set /p str=請把文件拉到本窗口後回車:
    call "%~0" %str%
    pause
    exit
    :next
    cls
    echo 本批處理文件完整路徑為:"%~0"
    echo 拖到本窗口的文件完整路徑為:"%~1"
    goto :eof
② 出現在 set /a 語句中時,表示兩數相除取餘數,也就是所謂的模運算,它在命令行窗口和批處理文件中的寫法略有差異:在命令行窗口中,只需要單個的%,在批處理文件中,需要連續兩個百分號,寫成%%。
例如:在命令行窗口中,運行 set /a num=4%2 ,則結果將顯示0,因為4除以2的餘數為0;如果保存為批處理文件,則此語句將略有改變:
    @echo off
    set /a num=4%%2
    echo 4除以2的餘數為 %num%
    pause
③ 轉義符號:如果要顯示%本身時,需要在前面用%來轉義。例如:
    @echo off
    echo 一個百分號:%%
    echo 兩個百分號:%%%%
    echo 三個百分號:%%%%%%
    pause
3、:、::
① 以:打頭的單個的:表示該行是一個標籤,它之後的內容是一個標籤段,如:test,則表示:test之下的內容是標籤段,而test是這個標籤段的名,可 以用 goto test 、goto :test 跳轉到該標籤段或用 call :test 調用該子過程;而連續兩個冒號打頭表示該行內容為註釋內容,實際上,:: 是個無效的標籤名,:加上空格同樣可以起到註釋的作用,此時,::的功能和註釋命令rem相同;但是,rem 註釋語句中的某些命令符號如重定向符號和管道符號還是會執行,而如果用::來註釋的時候,與::同處一行的所有命令或符號直接被命令解釋器忽略掉,無形中 提高了註釋的兼容性和整個程序的執行效率,並且在眾多的命令語句中更顯得醒目,所以,註釋語句推薦使用::的格式。
② 在 set 語句中:和~同時使用時,: 起到截取字符串的功能。假設 set str=abcde,那麼,set var=%str:~0,1% 表示截取字符串abcde的第一個字符;和=同時使用時,起到替換字符串的功能。假設:set str=abc:de,那麼,set var=%str:a=1% 則表示把字符串abc:de中的a替換為1,set var=%str::=2% 則表示把字符串abc:de中的:替換為2;
4、~
① 用在 set 語句中,和:同時使用時,起到截取字符串的功能,請參考上一條的解釋;
② 用在 set /a 語句中時,它是一元運算符號,表示將操作數字按位取反,例如,set /a num=~1的執行結果是-2,set /a num=~0的結果是-1
③ 用在for語句中,表示增強for的功能,能夠提取到更多的信息。例如:在批處理文件的for語句中:%%~i表示去掉第一對外側引號,%%~zi表示獲 取文件的大小(以字節為單位),%%~ni表示獲取文件名,%%~xi表示獲取擴展名(帶點號)……它們可以組合使用,如%%~nxi表示獲取文件名和後 綴名。
5、>、>>
一般而言,>表示用新內容覆蓋原文件內容,>>表示向原文件追加內容,此時,它們以重定向符號的身份出現;如果用在 set /a 語句中,則>表示分組,>>表示邏輯移位;
6、|
一般而言,它以管道符號的身份出現,表示把在它之前的命令或語句的執行結果作為在它之後的命令或語句的處理對象,簡而言之,就是 把它之前的輸出作為它之後的輸入,例如:echo abcd|findstr "b",表示把echo abcd的執行結果,作為findstr "b" 的執行對象,也就是在字符串abcd中查找b字符;如果test.txt中有abcd字符串,則該語句與 findstr "b" test.txt 具有同樣的效果;
7、^
一般而言,^以轉義字符的身份出現。因為在 cmd環境中,有些字符具備特殊功能,如>、>>表示重定向,|表示管道,&、&&、||表示語句連接……它 們都有特定的功能,如果需要把它們作為字符輸出的話,echo >、echo | ……之類的寫法就會出錯——cmd解釋器會把它們作為具有特殊功能的字符對待,而不會作為普通字符處理,這個時候,就需要對這些特殊字符做轉義處理:在每 個特殊字符前加上轉義字符^,因此,要輸出這些特殊字符,就需要用 echo ^>、echo ^|、echo ^|^|、echo ^^……之類的格式來處理;
8、&
一般而言,&表示兩條命令或語句同時執行的意思。如 echo a&echo b,將在屏幕上同時顯示a和b字符。當幾條語句含義近似或作用相同且沒有先後的順序之別時,啟用&符號連接這些語句將會增加程序的可讀性;
9、&&、||
這是一對含義截然相反的命令符,&&表示如果它之前的語句成功執行,將執行它之後的語句,而||則表示如果它之前的語句執行失敗,將執行它之後的語句;在某些場合,它們能替代 if……else…… 語句;例如:
    @echo off
    md test&&echo 成功創建文件夾test||echo 創建文件夾test失敗
    pause
效果等同於如下代碼:
    @echo off
    md test
    if "%errorlevel%"=="0" (echo 成功創建文件夾test) else echo 創建文件夾test失敗
    pause
10、()
小括號對經常出現在for語句和if語句中,還有一些特定場合;在for和if語句中屬於語句格式的要求,例如:
① for %%i in (語句1) do (語句2):在這條語句中,語句1必須用括號對包圍,而語句2的括號對則可視情況予以拋棄或保留:如果語句2是單條語句或用&、& &、||等連接符號連接的多條語句,括號對可以拋棄,如果語句2是有邏輯先後關係的多條語句集合,則必須保留括號對,並且,多條語句必須斷行書 寫;例如:
    @echo off
    for %%i in (a b c) do echo %%i&echo --------
    pause
也可以改寫為:
    @echo off
    for %%i in (a b c) do (
        echo %%i
        &echo --------
    )
    pause
② if 條件 (語句1) else (語句2):如果沒有else部分,則語句1的括號對可有可無;如果有else部分,則語句1中的括號對必須保留,此時,語句2中的括號對保留與否,和上一點類似。例如:
    @echo off
    if exist test.txt echo 當前目錄下有test.txt
    pause
    @echo off
    if exist test.txt (echo 當前目錄下有test.txt) else echo 當前目錄下沒有test.txt
    pause
    @echo off
    if exist test.txt (echo 當前目錄下有test.txt) else (
        echo 當前目錄下沒有test.txt
        pause
        cls
        echo 即將創建test.txt文件
        cd.>test.txt&&echo 成功創建test.txt
    )
    pause
③ 特定場合下使用括號對,不但可以使代碼邏輯清晰,增強可讀性,還可能會減少代碼量。比如用echo語句構造多行文本內容的時候:
    @echo off
    (
    echo 第一行
    echo 第二行
    echo 第三行
    )>test.txt
    start test.txt
如果不使用括號對的話,則需要使用如下代碼:
    @echo off
    echo 第一行>test.txt
    echo 第二行>>test.txt
    echo 第三行>>test.txt
    start test.txt
11、+、-、*、/
在 set /a 語句中,這些符號的含義分別為:加、減、乘、除。例如:set /a num=1+2-3*4/5。需要注意的是,這些運算符號遵循數學運算中的優先級順序:先乘除後加減,有括號的先算括號,並且,直接忽略小數點,因此,剛 才那個算式的結果是1而不是0或0.6。
另外,有可能會在代碼中看到這樣的寫法:set /a num+=1、set /a num-=1、set /a num*=1 和 set /a num/=1,這些表示累加、累減、累乘、累除,步長都是1,展開後的完整寫法為:set /a num=num+1、set /a num=num-1、set /a num=num*1 和 set /a num=num/1(set /a 語句中,變量引用可以忽略百分號對或感嘆號對,set /a num=%num%+1 與 set /a num=num+1 等同)
12、equ、neq、lss、leq、gtr、geq
這幾個命令符是if語句中常用到的數值比較符號,取自英文的關鍵字母,具體的含義為:
        命令符號        含義                英文解釋
        EQU                等於                equal
        NEQ                不等於                 not equal
        LSS                少於                 less than
        LEQ                少於或等於         less than or equal
        GTR                大於                 greater than
        GEQ                大於或等於         greater than or equal

*.bat相關-2

1.Format
格式化磁片以供 Windows 使用。

FORMAT volume [/FS:file-system] [/V:label] [/Q] [/A:size] [/C] [/X] [/P:passes]
FORMAT volume [/V:label] [/Q] [/F:size] [/P:passes]
FORMAT volume [/V:label] [/Q] [/T:tracks /N:sectors] [/P:passes]
FORMAT volume [/V:label] [/Q] [/P:passes]
FORMAT volume [/Q]

  volume          指定磁碟機代號 (後接冒號)、掛接點或磁碟區名稱。
  /FS:filesystem  指定檔案系統的類型 (FAT、FAT32、exFAT、NTFS 或
                  UDF)。
  /V:label        指定磁碟區標籤。
  /Q              執行快速格式化。請注意,此參數會覆寫 /P。
  /C              只限 NTFS: 根據預設值,建立在新磁碟區上的檔案
                  會被壓縮。
  /X              視需要先將磁碟區解下。
                  所有在磁碟區上開啟的控制碼都不再是正確的。
  /R:revision     只限 UDF: 將格式限制為特定的 UDF 版本
                  (1.02, 1.50, 2.00, 2.01, 2.50)。預設版本是 2.01。
  /D              限 UDF 2.50: 會重複中繼資料。
  /A:size         覆寫預設的配置單位大小。建議在一般使用時,最好
                  使用預設值。
                  NTFS 支援 512、1024、2048、4096、8192、16K、32K 和 64K。
                  FAT 支援 512、1024、2048、4096、8192、16K、32K、64K、
                  (128K、256K 供磁區容量 > 512 位元組使用)。
                  FAT32 支援 512、1024、2048、4096、8192、16K、32K、64K、
                  (128K、256K 供磁區容量 > 512 位元組使用)。
                  exFAT 支援 512、1024、2048、4096、8192、16K、32K、64K、
                  128K、256K、512K、1M、2M、4M、8M、16M、32M。

                  請注意 FAT 及 FAT32 檔案系統強制限制
                  在磁碟區的叢集數目:

                  FAT: 叢集數目 <= 65526
                  FAT32: 65526 < 叢集數目 < 4177918

                  如果格式化發現使用指定的叢集大小無法符合
                  上面的要求,格式化將會自動停止
                  執行。

                  NTFS 壓縮不支援大於 4096 的配置
                  單位。

  /F:size         指定要格式化的軟碟大小 (1.44)
  /T:tracks       為磁片各面指定磁軌數量。
  /N:sectors      指定各條磁軌的磁碟區數量。
  /P:passes       0 磁碟區的每一個磁區通過次數。 此參數
                  不能用於 /Q
 
2.如何在批處理文件中使用參數  
批處理中可以使用參數,一般從%1到%9這九個,當有多個參數時需要用shift來移動
,這種情況並不多見,我們就不考慮它了。 
 
sample1:format.bat  a
@echo off 
if \%1\==\a\ format a:  
:format  
@format a:/q/u/auotset  
@echo please insert another disk to driver A.  
@pause  
@goto format 
 
3.Compound Command
a.&
Usage:第一條命令 & 第二條命令 [& 第三條命令...]  
用這種方法可以同時執行多條命令,而不管命令是否執行成功 
Sample:  
dir z: & dir c:\Ex4rch  

b.&& 
Usage:第一條命令 && 第二條命令 [&& 第三條命令...]  
用這種方法可以同時執行多條命令,當碰到執行出錯的命令後將不執行後面的命令,如果一 
直沒有出錯則一直執行完所有命令
Sample:  
dir z: && dir c:\Ex4rch
 
c.||
Usage:第一條命令 || 第二條命令 [|| 第三條命令...]  
用這種方法可以同時執行多條命令,當碰到執行正確的命令後將不執行後面的命令, 
有出現正確的命令則一直執行完所有命令
 
4.|
Usage:第一條命令 | 第二條命令 [| 第三條命令...]  
將第一條命令的結果作為第二條命令的參數來使用,記得在unix中這種方式很常見。
sample:  
time /t D:\IP.log  
netstat -n -p tcp|find \:3389\>>D:\IP.log 
start Explorer  
TIME [/T | time]

僅鍵入 TIME 而不加上參數,可以顯示目前設定的時間,並且提示您輸入新的時
間。按 ENTER 鍵即可保持原來時間。

如果您啟用擴充命令,TIME 命令將會支援/T 參數,這個參數
會讓命令只輸出目前的時間,而不提示您輸入新時間。

FIND [/V] [/C] [/N] [/I] [/OFF[LINE]] "string" [[drive:][path]filename[ ...]]
搜尋檔案中的文字字串。

  /V        顯示所有不包含指定字串的行。
  /C        只顯示包含字串的行數。
  /N        顯示每一行及它的行號。
  /I        當搜尋字串時,忽略字元的大小寫。
  /OFF[LINE] 不要略過有離線屬性設定的檔案。
  "string"  指定要尋找的文字字串。
  [drive:][path]filename
            指定要尋找的檔案。

如果沒有指定路徑,FIND 會搜尋在提示字元中所輸入的文字
或者在其他的命令中搜尋。

5.>>>
將一條命令或某個程序輸出結果重定向到特定文件中, > 與 >>的區別在
>會清除調原有文件中的內容後寫入指定文件,而>>只會追加內容到指定文件中
,而不會改動其中的內容。  
sample1:  
echo hello world>>c:\hello.txt
 
6. fc
比較兩個檔案或兩組檔案並且顯示其中的不同之處


C [/A] [/C] [/L] [/LBn] [/N] [/T] [/U] [/W] [/nnnn] [drive1:][path1]filename1
         [drive2:][path2]filename2
C /B [drive1:][path1]filename1 [drive2:][path2]filename2

  /A         針對每組不同之處只要顯示其中的第一行和最後一行。
  /B         使用二進位的內容比較。
  /C         忽略字母的大小寫。
  /L         以 ASCII 文字檔案方式來比較檔案。
  /LBn       在指定的行數中設定容許的最多連續的檔案
             不相符。
  /N         在 ASCII 方式的比較中顯示行數。
  /OFF[LINE] 不以離線屬性組略過檔案。
  /T         不要將定位字元展開為空格。
  /U         以 UNICODE 文字檔案方式來比較檔案。
  /W         將空白字元 (定位字元和空格) 壓縮後再進行比較。
  /nnnn      指定在一處不相同之後必須相同的連
             續行數。
 [drive1:][path1]filename1
             指定要比較的第一個檔案或第一組檔案。
 [drive2:][path2]filename2
             指定要比較的第二個檔案或第二組檔案。
 
7.findstr
在檔案中搜尋字串。

FINDSTR [/B] [/E] [/L] [/R] [/S] [/I] [/X] [/V] [/N] [/M] [/O] [/P] [/F:file]
        [/C:string] [/G:file] [strings] [[drive:][path]filename[ ...]]

  /B        如果是在行的開端,則符合類型。
  /E        如果是在行的尾端,則符合類型。
  /L        逐字使用搜尋字串。
  /R        使用搜尋字串為一般表示式。
  /S        在現存目錄及所有的子目錄中
            搜尋符合的檔案。
  /I        指定搜尋不區分大小寫。
  /X        列印完全符合的行數。
  /V        只列印不含相符字串的行數。
  /N        列印每一行符合的行數前的行編號。
  /M        只列印包含相符字串的檔案的檔案名稱。
  /O        列印每一個相符行之前的字元位移。
  /P        略過沒有可列印字元的檔案。
  /F:file   從指定的檔案讀取檔案清單 (/ 代表主控台)。
  /C:string 使用特定的字串作為逐字搜尋的字串。
  /G:file   從指定的檔案取得搜尋字串 (/ 代表主控台)。
  /D:dir    搜尋以分號隔開的目錄清單。
  strings   要搜尋的文字。
  [drive:][path]filename
            指定要搜尋的一個或多個檔案。

除非引數的字首有 /C,否則請以空格將多重搜尋
字串分開。例如,'FINDSTR "hello there" x.y'
將會在檔案 x.y 中搜尋 "hello",或 "there"。
'FINDSTR /C:"hello there" x.y' 將會在檔案
x.y 中搜尋 "hello there"。

常見表示快速對照表:
  .        萬用字元: 任何字元
  *        重複: 零或之前字元或類別發生數次
  ^        行的位置: 行的開頭
  $        行的位置: 行的結尾
  [class]  字元類別: 組的任何一個字元
  [^class] 顛倒的類別: 不成組的任何一個字元
  [x-y]    範圍: 在特定範圍內的任何字元
  \x       跳開: metacharacter x 的字面使用方法
  \  xyz\>    字的位置: 字的結尾

有關 FINDSTR 一般表示式的資訊,請參閱線上
命令參照。

2012/10/22

*.bat相關-1

1.Echo  
顯示訊息,或切換命令回應的開啟狀態。

  ECHO [ON | OFF]
  ECHO [message]

僅鍵入 ECHO 而不加上參數,可以顯示目前的 ECHO 設定。

2.@ 
表示不顯示@後面的命令。 
Sample:
@echo off 
@echo Now initializing the program,please wait a minute...  
@format X: /q/u/autoset 
(format 這個命令是不可以使用/y這個參數的,可喜的是微軟留了個
autoset這個參數給我們,效果和/y是一樣的。) 
 
3.Goto
將 cmd.exe 導向到批次程式裡標籤指定的位置。

GOTO label

  label   指定批次程式裡做為標籤名稱的文字字串。

標籤名稱必須單獨一行,並且以冒號開頭。

如果您啟用擴充命令,GOTO 命令的變更如下:

GOTO 命令接收到一個目標標籤: EOF,而此標籤會將控制
傳輸到目前批次指令檔的尾端。利用此簡單的方式,可不
必定義標籤便即離開批次指令檔。鍵入 CALL /? 以查看有關
CALL 擴充命令發揮此特性的描述。
 
4.Rem
在批次檔或 CONFIG.SYS 裡加上備註或說明。

REM [comment]
 
5.Pause
暫停執行批次程式,並且顯示以下訊息:
    請按任意鍵繼續 . . . 
Sample: 
@echo off  
:begin  
copy a:*.* d:\back  
echo Please put a new disk into driver A  
pause  
goto begin 
Driver A 中所有文件均複製到d:\back目錄下。顯示提示您將另一張磁片放入
Driver A 時,pause 命令會使程式暫停,以便更換磁,然後按任意鍵繼續處理。
 
6.Call
從批次程式中呼叫另一程式。

CALL [drive:][path]filename [batch-parameters]

  batch-parameters   指定批次程式所需要的命令列資訊。

如果您啟用擴充命令,CALL 命令的變更如下:

CALL 命令現在可以用標籤來當作 CALL 命令的目標。語法為:

    CALL :label arguments

這會用指定的 arguments 來建立一個新的批次檔檔案內容,而且控制權
會被傳到指定的 label 後的敘述。您必須經由達到批次指令檔的結尾兩
次來 "exit" 兩次。第一次您讀入批次檔結尾時,控制權會回到 CALL
描述的下一個敘述。而第二次則會結束批次檔的執行。請鍵入 GOTO /?
來獲得 GOTO :EOF 擴充命令的描述。 這個命令可以讓您從批次檔中
"return" 。

此外,批次檔參數的參考 (%0,%1 及其他) 已經做了如下的擴充:


    %* 在批次檔中,這代表所有的參數 (e.g. %1 %2 %3
        %4 %5 ...)

    批次參數的取代 (%n) 已經做了改進。  您現在可以選用下列的
    語法:

        %~1         - 展開 %1 且移除包圍的引號 (")
        %~f1        - 展開 %1 為一個完全符合的路徑名稱
        %~d1        - 只展開 %1 為磁碟機代號
        %~p1        - 只展開 %1 為路徑
        %~n1        - 只展開 %1 為檔名
        %~x1        - 只展開 %1 為副檔名
        %~s1        - 展開的路徑只包含短檔名
        %~a1        - 展開 %1 為檔案的檔案屬性
        %~t1        - 展開 %1 為檔案的日期/時間
        %~z1        - 展開 %1 為檔案的長度
        %~$PATH:1   - 搜尋所有列在 PATH 環境變數內的目錄且
                       展開 %1 為第一個找到的完全符合檔名。
                       如果沒有定義環境變數名稱或是搜尋找不
                       到檔案,則這個修飾元會展開成空字串。

    修正程式可合併使用,進而得到複合結果:

        %~dp1       - 只擴充 %1 到磁碟機代號和路徑
        %~nx1       - 只擴充 %1 到檔案名稱和副檔名
        %~dp$PATH:1 - 搜尋 %1 的 PATH 環境變數中所列的
                       目錄,並擴充至磁碟機代號和第一個
                       找到的路徑。
        %~ftza1     - 將 %1 擴充成 DIR ,和輸出行相同

    在上例中,%1 和 PATH 可被其他有效值取代。%~ 語法是
    以正確的引數數字作結尾。%~ 修正程式可能無法使用 %* 
 
7.Start
開始另一個視窗來執行指定的程式或命令。

START ["title"] [/D path] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED]
      [/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL]
      [/AFFINITY ] [/WAIT] [/B] [command/program]
      [parameters]

    "title"     要在視窗標題列顯示的標題。
    path        開始目錄
    B           啟動應用程式但不建立新視窗。含有 ^C 控制碼的應用程式會被略過,
                除非應用程式啟用 ^C 程序,否則 ^Break 是唯一可以中斷應用程式的
                方法
    I           新環境會使用傳遞給 cmd.exe 的原始環境,而不是目前的環境。
    MIN         視窗最小化
    MAX         視窗最大化
    SEPARATE    在不同的記憶體空間啟動 16 位元視窗程式
    SHARED      在共用的記憶體空間啟動 16 位元視窗程式
    LOW         在 IDLE 優先類別中啟動應用程式
    NORMAL      在 NORMAL 優先類別中啟動應用程式
    HIGH        在 HIGH 優先類別中啟動應用程式
    REALTIME    在 REALTIME 優先類別中啟動應用程式
    ABOVENORMAL 在 ABOVENORMAL 優先類別中啟動應用程式
    BELOWNORMAL 在 BELOWNORMAL 優先類別中啟動應用程式
    AFFINITY    新的應用程式將具有指定處理器的相關性遮罩,以十六進位數字表示。
    WAIT        啟動應用程式並等待其結束
    command/program
                如果這是內部 cmd 命令或批次檔,命令處理器會使用 /K 參數執行
                cmd.exe。這表示視窗會保持到命令執行完成。

                如果這不是內部 cmd 命令或批次檔,它就是一個程式,它會以視窗程式
                或主控台應用程式的執行方式執行。
    parameters      這些是傳遞給 command/program 的參數。

注意: SEPERATE 與 SHARED 選項不支援 64 位元平台。

如果您啟用擴充命令,經由命令列或 START 命令的外部命令執行有以下改變:

可以經由打入檔案名稱的命令來利用檔名連結以啟動非執行檔。(例如 WORD.DOC
    會執行和 .DOC 副檔名連結的程式)。請參看 ASSOC 及 FTYPE 命令來了解
    如何在指令檔案中建立這些檔案連結。

當執行 32 位元的圖形介面應用程式時,CMD.EXE 並不會等應用程式停止才回到
    命令提示。但是如果從指令檔中執行時,則不會有這樣的行為。

當執行一個命令列時,其中第一個字串項是字串 "CMD " 且沒有副檔名或路徑指
    示,則 "CMD" 會被 COMSPEC 環境變數的值所取代。這會避免由目前目錄中
    選擇 CMD.EXE

當執行一個命令列時,其中第一個字串項不包含副檔名時,則 CMD.EXE 使用
    PATHEXT 環境變數的值來決定尋找哪個副檔名及用什麼順序來尋找。PATHEXT
    變數的預設值為:

        .COM;.EXE;.BAT;.CMD

    請注意這個語法和 PATH 變數相同,且用分號來隔開不同的項目。

當尋找執行檔時,若是任何副檔名都不符合,則會試著尋找是否有符合的目錄名稱。
如果有的話,START 命令會在那個路徑執行檔案管理員。若是從命令列執行,這就相
當於執行 CD /D 到那個路徑。
 
8.choice
CHOICE [/C choices] [/N] [/CS] [/T timeout /D choice] [/M text]

描述:
    這個工具可以讓使用者從一些選擇中
    選取一個項目,並將選取的選擇傳回索引。

參數清單:
   /C    choices       指定要建立的選擇清單。
                       預設清單是 "YN"。

   /N                  將選擇清單隱藏在提示中。
                       已經顯示提示之前的訊息,
                       選擇仍在啟用中。

   /CS                 啟用會區分英文大小寫 的選擇以供選取。
                       預設的情況是公用程式不會區分英文大小寫。

   /T    timeout       做出預設選擇之前
                       要暫停的秒數。可接受的值介於 0 到
                       9999。如果指定 0 的話,將不會暫停
                       並將選取預設選擇。

   /D    choice        在 nnnn 秒之後指定預設選擇。
                       字元必須在以  /C 選項所指定的選擇組之中,
                       而且必須以 /T 指定 nnnn。

   /M    text          指定出現在提示之前
                       的訊息。未指定的話,公用程式將只顯示
                       提示字元。

   /?                  顯示這個說明訊息。

   注意事項:
   ERRORLEVEL 環境變數應設成由選擇組中選
   取的機碼索引。列出的第一個選擇傳回值 1,
   第二個選擇傳回 2,以此類推。
   如果使用者按的機碼是無效的選擇,工具會
   發出警告的嗶聲。如果工具偵測出錯誤情況,
   則會傳回 ERRORLEVEL 值等於 255。如果使用
   者按 CTRL+BREAK 或 CTRL+C,工具將傳回 ERRORLEVEL 值等於 0。
   當您在批次程式中使用 ERRORLEVEL 參數時,
   請以遞減順序列出。

範例:
   CHOICE /?
   CHOICE /C YNC /M "按是(Y)、否(N)或取消(C)。"
   CHOICE /T 10 /C ync /CS /D y
   CHOICE /C ab /M "參數 1 請選 a,參數 2 則選 b"。
   CHOICE /C ab /N /M "參數 1 請選 a,參數 2 則選 b"。
Sample:
choice /C YNC /M "按是(Y)、否(N)或取消(C)。"
if errorlevel==3 goto pC
if errorlevel==2 goto pN
if errorlevel==1 goto pY

:pY
echo press Y
goto :EOF

:pN
echo press N
goto :EOF

:pC
echo press C
goto :EOF


9.If
在批次檔中執行條件處理。

IF [NOT] ERRORLEVEL number command
IF [NOT] string1==string2 command
IF [NOT] EXIST filename command

  NOT               表示 Windows 應該只有在條件為偽時才執行命令。

  ERRORLEVEL number 當上一個執行的程式傳回的結束碼大於或等於指定
                    數字時,則條件為真。

  string1==string2  當指定的文字字串相符合時,則條件為真。

  EXIST filename    如果指定的檔名存在時,則條件為真。

  command           指定當條件為真時所要執行的命令。命令之後可以
                    接著 ELSE 命令。當指定條件為偽時,緊接在 ELSE
                    命令之後的命令將會被執行。

ELSE 子句必須出現在 IF 之後的同一行。例如:

    IF EXIST filename. (
        del filename.
    ) ELSE (
        echo filename. missing.
    )

以下命令無法作用,因為 del 命令必須以換行字元來結尾:

    IF EXIST filename. del filename. ELSE echo filename. missing

下面命令也無法作用,因為 ELSE 命令必須在與 IF 命令同一行的結尾:

    IF EXIST filename. del filename.
    ELSE echo filename. missing

下面命令只有在寫成一行時才能作用:

    IF EXIST filename. (del filename.) ELSE echo filename. missing

如果您啟用擴充命令,IF 的變更如下:

    IF [/I] string1 compare-op string2 命令
    IF CMDEXTVERSION 數字命令
    IF DEFINED 變數命令

compare-op 可以是:

    EQU - 等於
    NEQ - 不等於
    LSS - 小於
    LEQ - 小於或等於
    GTR - 大於
    GEQ - 大於或等於

而如果指定 /I 參數,則執行區分大小寫的字串比對。此 /I 參數也可使用
string1==string2 格式於 IF 命令。這些比對是通用的,因為在比對中,如
果 string1 及 string2 兩者皆由十進位數字所構成,則字串將會轉換為數
字,並執行數字的比對。

CMDEXTVERSION 條件式的運作和 ERRORLEVEL 一樣,除非它和與擴充命令相
關的內部版本編號作比對。第一個版本為 1。若擴充命令大幅度地增強時就
再加 1。當擴充命令停用時,CMDEXTVERSION 條件式永遠不為真。

DEFINED 條件式的運作和 EXISTS 一樣,除非它帶有環境變數名稱,如果環
境變數已定義則傳回 true 值。

%ERRORLEVEL% 將擴充到代表目前 ERRORLEVEL 變數的一個字串,前提是已
經沒有名為 ERRORLEVEL 的環境變數,在這個情況下,您會得到它的值。使
用此值和上面的數字比對運算元,您可以作下列的選擇:

    goto answer %ERRORLEVEL%
    :answer0
    提示您鍵入 Y 加以確定
    :answer1
    提示您鍵入N 加以否定

您也可使用上面的數字比對:

    IF %ERRORLEVEL% LEQ 1 goto okay

%CMDCMDLINE% 將擴充到比 CMD.EXE 的任何處理程序更早傳給 CMD.EXE 的
原始命令列,前提是已經沒有名為 CMDCMDLINE 的環境變數,在這個情形下,
您會得到它的值。

%CMDEXTVERSION% 將擴充成一個表示目前 CMDEXTVERSION 值的字串,
表示沒有名為 CMDEXTVERSION 的環境變數。這種情況下您將會得到它的值。
 
10.erroelevel
if errorlevel / if not errorlevel 數字  待執行的命令 
如果返回碼等指定的數字,則條件成立,運行命令,否則運行下一句。  
如if errorlevel 2 goto x2    
DOS程序運行時都會返回一個數字給DOS,稱為錯誤碼errorlevel或稱返回碼,常見的返回碼  
為0、1。   
 
11.For
對一組檔案中的每個檔案執行指定的命令。

FOR %variable IN (set) DO 命令 [command-parameters]

  %variable 指定一個可以取代的參數。
  (set)      指定由一或多個檔案組成的檔案組。您可使用通配字元。
  command    指定命令來執行每一個檔案。
 command-parameters
             為所指定的命令指定變數或參數。

如果要在批次程式中使用 FOR 命令,請指定 %%variable,而不要指定
%variable。  變數名稱有大小寫的區分,所以 %i 不同於 %I。

如果您啟用擴充命令,則額外支援下列的 FOR 命令
格式:

FOR /D %variable IN (set) DO command  [command-parameters]

    如果 set 中包含萬用字元,則指定與目錄
    名稱相符,而不是與檔案名稱相符。

FOR /R [[drive:]path] %variable IN (set) DO command  [command-parameters]

    在樹狀目錄中切換 [drive:]路徑,並於樹狀目錄的每一個目錄下執行
    FOR 陳述式。如果未在 /R 之後指定目錄規格,則採用目前的目錄。
    如果 set 只是單一句點 (.) 字元,則它只會列舉樹狀目錄結構。

FOR /L %variable IN (start,step,end) DO command [command-parameters]

    set 是從開頭到結尾一次跳一步的連續數字。所以 (1,1,5) 會產生
    連續值 (1 2 3 4 5) 而 (5,-1,1) 會產生連續值 (5 4 3 2 1)

FOR /F ["options"] %variable IN (file-set) DO command [command-parameters]
FOR /F ["options"] %variable IN ("string") DO command [command-parameters]
FOR /F ["options"] %variable IN ('command') DO command [command-parameters]

    或,如果使用 usebackq 選項:

FOR /F ["options"] %variable IN (file-set) DO command [command-parameters]
FOR /F ["options"] %variable IN ('string') DO command [command-parameters]
FOR /F ["options"] %variable IN (`command`) DO command [command-parameters]

    filenameset 可以是一個以上的檔案名稱。每個檔案都已開啟,
    讀取及處理過,才繼續進行下個檔案名稱組。處理檔案讀取的一致
    性,將它分成獨立的文字行,然後將每一行分析成零或更多的字串。
    用已找到的字串值為變數值,來呼叫 For 迴圈的內容。預設狀態,
    /F 傳出每個檔案的每一行中,以空格分隔的第一個字串。空白行
    會被略過。您可以指定 "options" 參數來覆寫預設的分析行為。
    這是有引號的字串,包含一個以上的關鍵字,來指定不同的分析
    選項。關鍵字是:

        eol=c           - 指定一個行尾註解字元
                          (只有一個)
        skip=n          - 指定在檔案開頭要掠過的
                          行數。
        delims=xxx      - 指定分隔符號的集合。  這會取代
                          預設的空白與定位字元的分隔符號集合。
        tokens=x,y,m-n  - 指定每一行的哪些文字串應該被
                          傳到 for 的內部以用來進行每一個重複操作。
                          這會導致額外的變數名稱被配置。
                          m-n 格式代表一個範圍,
                          指定了第 m 個到第 n 個字串項。
                          如果在 tokens= 字串的最後一個字元是
                          星號,則會配置一個額外的變數
                          來接收最後一個字串項被分析後
                          的其他文字。
        usebackq        - 指定新語義開始作用。
                          其中反括號的字串會被當作命令來執行,
                          而單引號字串是純文字字串。
                          此外還允許使用雙引號來
                          引用在 filenameset 內
                          的檔名。

    以下是一個範例:

FOR /F "eol=; tokens=2,3 delims=, " %%i in (myfile.txt) do @echo %%i %%j %%k

    這會分析 myfile.txt 檔案中的每一行,它不會去管以分號開頭的行數
    ,直接將第 2 個及第 3 個語法從每一行傳到 for 主體,而其語法是
    用逗號和/或空格分開的(delims不放在最後即使條件有空格不會被納
    入分隔條件)。請注意,for 主體陳述式參照 %i 以取得第
    二個語法,參照 %j 以取得第三個語法,使用 %k 取得第三個語法之
    後的剩餘字串。因為檔案名稱含有空格,您必須用雙引號來括住檔案名
    稱。要這樣使用雙引號,您必須使用 usebackq 參數。否則雙引號會被
    解譯成用來定義一般文字。

    使用 %i 明白地在 for 陳述式中宣告,並透過 tokens= option 使用
    %j 作暗式性的宣告。您可以藉由 tokens= line 來指定最多 26 個語
    法,前提是它宣告的變數不能高於字母 'z' 或 'Z'。請記住,FOR 變
    數是單一字元的,同時在任一時間內,您不能同時使用超過 52 個 FOR
    變數。

    您也可以使用 FOR /F 命令在立即字串中分析邏輯,方法是將括弧之間的
    filenameset 變成一個引號字串。它會被視為從檔案輸入的單行,並加
    以分析。

    最後,您可以使用 FOR /F 命令來分析一個命令的輸出。方法是將括弧
    內的 filenameset 變成單引號字串。它將被視為一個命令列,這個命令
    行將會傳到子 CMD.EXE,而輸出將會被擷取到記憶體中,當成檔案來分
    析。所以下列的範例:

        FOR /F "delims==" %%i IN ('set') DO @echo %%i

    將列舉目前環境中的環境變數名稱。

此外,已經加強了 FOR 變數參考的取代功能。
您現在可以選用下列的語法:

    %~I         - 展開 %I 且移除包圍的引號 (")
    %~fI        - 展開 %I 為一個完全符合的路徑名稱
    %~dI        - 只展開 %I 為磁碟機代號
    %~pI        - 只展開 %I 為路徑
    %~nI        - 只展開 %I 為檔名
    %~xI        - 只展開 %I 為副檔名
    %~sI        - 展開的路徑只包含短檔名
    %~aI        - 展開 %I 為檔案的檔案屬性
    %~tI        - 展開 %I 為檔案的日期/時間
    %~zI        - 展開 %I 檔案的長度
    %~$PATH:I   - 搜尋所有列在 PATH 環境變數內的目錄
                   且展開 %I 為
                   第一個找到的完全符合檔名。
                   如果沒有定義環境變數名稱
                   或是搜尋找不到檔案,
                   則這個修飾元會展開為
                   空字串。

修飾元可以合併使用以獲得綜合的結果:

    %~dpI       - 只展開 %I 為磁碟機代號與路徑
    %~nxI       - 只展開 %I 為檔名與副檔名
    %~fsI       - 只展開 %I 為含短檔名的完全路徑
    %~dp$PATH:i - 為 %I 搜尋所有列在 PATH 環境變數內的目錄
                   且展開第一個找到的項目為磁碟機代號及
                   路徑。
    %~ftzaI     - 展開 %I 為像 DIR 一樣的輸出行

在上面的範例中 %I 和 PATH 能用其他的合法值取代。%~ 語法是由合法的
FOR 變數名稱來終止。如果選用像 %I 的大寫名稱可以增加可讀性而且避免
和修飾元的混淆,因為這些並不區分大小寫。 
 
12.Set
顯示、設定或移除 cmd.exe 環境變數。

SET [variable=[string]]

  variable  指定環境變數名稱。
  string    指定設定給變數的一系列字元。

僅鍵入 SET 而不加上任何參數,可以顯示目前的環境變數。

如果您啟用了擴充命令,SET 命令有以下的改變:

如果執行 SET 命令而且只包含變數名稱,沒有等號或數值的話,
命令會顯示出所有字首符合 SET 命令中指定變數名稱的所有變數
值。例如:

    SET P

會列出所有以 'P' 為開頭的環境變數。

如果在目前的環境中找不到變數名稱,SET 命令會將 ERRORLEVEL
設為 1。

SET 命令不將等號 (=) 視為變數名稱的一部份。

有兩個新參數已經加到 SET 命令中:

    SET /A expression
    SET /P variable=[promptString]

/A 指定在等號右方的字串是一個要被運算的數字運算式。您可以用運
算式進行簡單的運算,而且支援下列的運算子 (依照運算優先順序由高
到低排列):

    ()                  - 組成一群
    ! ~ -               - 一元運算符
    * / %              - 數字運算元
    + -                 - 數字運算元
    << >>               - 邏輯位移
    &                   - 位元運算 and
    ^                   - 位元運算 exclusive or
    |                   - 位元運算 or
    = *= /= %= += -=   - 指定
    &= ^= |= <<= >>=
    ,                   - 運算式分隔字元

如果您使用了任何邏輯或餘數運算子,您必須將運算式兩邊括上引號。
任何在運算式中非數字的字串會被當作環境變數,並且在使用前會先將
這些環境變數轉換為數字。如果您所指定的環境變數名稱尚未在目前環
境中定義,那麼它的值會被設為 0。這可以讓您用環境變數值來做運算
,而不必打入所有的 % 符號來取得它的值。如果 SET /A 是用指令檔
之外的命令列執行,它會顯示運算式最後的數值。指定運算子需要有個
環境變數在等號的左方。0x 字首在數字前方代表十六進位數字、0b 字
首代表二進位數字或 0 字首代表八進位數字,否則數字值都是指十進位
數字。所以 0x12 就和 18、022 等相同。請注意八進位數字可能容易
弄錯: 像 08 和 09 就不是正確的數字,因為 8 和 9 並不是八進位的
正確數字。

/P 參數讓您設定命令列的使用者輸入變數值。在讀取輸入命令列之前,
顯示指定的 promptString。promptString 可以是空白。

環境變數取代功能已經有下列增強:

    %PATH:str1=str2%

會將 PATH 環境變數展開,取代每個發現的 "str1" 與 "str2"的擴充結果。
"str2" 可以是空白字串,這會從擴充輸出中刪除全部 "str1"。"str1" 可以
用星號開始,這將會從擴充輸出的開頭開始,對應到從所有第一個發現含有
str1 的項目。

您也可以為擴充功能指定子字串。

    %PATH:~10,5%

這將會擴充 PATH 環境變數,然後只使用擴充結果的第 11 個(位移 10)字元
後的 5 個字元如果長度未指定,將會預設為上次使用的變數值。如果數字(位
移或長度)是負數,使用的數字將會是環境變數的長度加上位移或指定長度。

    %PATH:~-10%

將抽出 PATH 變數的最後 10 個字元。

    %PATH:~0,-2%

將抽出 PATH 變數的最後 2 個字元。

最後,系統加入了延遲環境變數展開的支援。在預設狀態下,命令展開會啟
用這項支援,但是您可以在 CMD.EXE 用 /V 命令列參數來啟用/停用這個功
能。 請參看 CMD /?

延遲環境變數展開功能可用來避開展開功能限制。這項限制是發生在命令列
讀取過程,不是發生在執行過程。下面的範例說明了立即展開變數時會發生
的問題:

    set VAR=before
    if "%VAR%" == "before" (
        set VAR=after;
        if "%VAR%" == "after" @echo If you see this, it worked
    )

這個例子永遠無法顯示 echo 訊息,因為在兩個 IF 敘述中的 %VAR% 會
在第一個 IF 敘述被讀入時便被展開。這是因為它是邏輯上包含了 IF 的內
部,而內部又是一個複合敘述。  所以在複合敘述內的 IF 實際上是用
"before" 和 "after" 來比較,而這永遠不會為真。同樣的,下面的例子也
不會作用:

    set LIST=
    for %i in (*) do set LIST=%LIST% %i
    echo %LIST%

這個例子中並不會建立目前目錄中所有檔案的清單,相反的只會將 LIST 變
數設為最後一個找到的檔案。同樣地,這是因為 %LIST% 只有在 FOR 敘述
第一次被讀入時才展開,此時 LIST 變數是空的。所以我們實際執行的 FOR
迴圈是:

    for %i in (*) do set LIST= %i

這只是重複的將 LIST 設為最後找到的檔案。

延遲環境變數展開讓您可以用一個不同的字元 (驚嘆號) 在執行時展開
環境變數。如果啟用了延遲環境變數展開,上面的例子可以被改寫如下
而正常作用:

    set VAR=before
    if "%VAR%" == "before" (
        set VAR=after
        if "!VAR!" == "after" @echo If you see this, it worked
    )

    set LIST=
    for %i in (*) do set LIST=!LIST! %i
    echo %LIST%

如果您啟用了命令擴充,有幾個動態環境變數會被展開但是不會出現在 SET
所顯示的環境變數列表中。這些變數的值會每次在這些變數被展開時動態地
重新計算如果使用者用這些變數的名稱來定義變數時,則這個新定義會覆蓋
以下所列的動態變數:

%CD% - 展開為含目前目錄的字串。

%DATE% - 展開為與 DATE 命令格式相同的目前日期字串。

%TIME% - 展開為與 TIME 命令格式相同的目前時間字串。

%RANDOM% - 展開為一個在 0 和 32767 之間的整數亂數值。

%ERRORLEVEL% - 展開為目前的 ERRORLEVEL 值

%CMDEXTVERSION% - 展開為目前的命令處理擴充功能的版本號碼。

%CMDCMDLINE% - 展開為執行命令處理器前的原始命令列。 
 
13.cmd 
啟動一個 Windows 命令直譯器的新例項

CMD [/A | /U] [/Q] [/D] [/E:ON | /E:OFF] [/F:ON | /F:OFF] [/V:ON | /V:OFF]
    [[/S] [/C | /K] string]

/C      執行字串中所描述的命令然後結束命令視窗
/K      執行字串中所描述的命令然後保留命令視窗
/S      修改字串在 /C 或 /K (參看下方)
/Q      關閉 echo
/D      從登錄中停用 AutoRun 命令(參看下方)
/A      將內部命令輸出結果以 ANSI 格式導向 pipe 或檔案
/U      將內部命令輸出結果以 Unicode 格式導向 pipe 或檔案
/T:fg   設定幕前/幕後色彩 (參看 COLOR /?)
/E:ON   啟用命令延伸 (參看下方)
/E:OFF  停用命令延伸 (參看下方)
/F:ON   啟用檔案及目錄名稱完整字元(參看下方)
/F:OFF  停用檔案及目錄名稱完整字元(參看下方)
/V:ON   啟用延遲環境變數延伸,用 ! 作為分隔字元。例如, /V:ON
        可以讓 !var! 在執行時展開變數 var。文法 var 則會在
        輸入時展開變數,這在 FOR 迴圈之中是完全不同的事。
/V:OFF  停用延遲環境變數展開

請注意用命令分隔字元 '&&' 隔開的多個命令如果被引號包含時則會
被當成字串來接受。此外,為了相容性的原因,/X 的作用與 /E:ON
相同; /Y 與 /E:OFF 相同且 /R 與 /C 相同。其餘的參數則會被忽
略。

如果指定了/C 或 /K,則在參數後的其餘命令列會被當成命令列來處
理,其中使用下面的邏輯來處理引號字元 (") :

    1.  如果所有下列條件都符合,那麼命令列上的引號會被保留:

        - 沒有 /S 參數
        - 正好有兩個引號
        - 在兩個引號之間沒有下列特殊字元: <>()@^|
        - 兩個引號之間有一些空格
        - 在兩個引號之間的字串是執行檔的檔案名稱。

    2.  否則,如果第一個字元是引號,舊的命令列會把前置字元去
        掉,並將命令列中第一個引號及最後一個引號之間的所有文
        字變成保留文字。

如果您在命令列中未指定 /D,當 CMD.EXE 起動後,
它會尋找下列 REG_SZ/REG_EXPAND_SZ的 登錄變數。如果
有一個存在或兩個都存在,命令會執行第一個變數。

HKEY_LOCAL_MACHINE\Software\Microsoft\CommandProcessor\AutoRun

及/或

HKEY_CURRENT_USER\Software\Microsoft\CommandProcessor\AutoRun

將命令擴充功能預設成啟用狀態。您可以在特定的呼叫中,用 /E:OFF
參數來停用擴充功能。您可以啟用或停用一台電腦上或使用者登入工作
階段中所有 CMD.EXE 呼叫的擴充功能,如果您要這樣作,請使用
REGEDIT.EXE 來設定以下的 REG_DWORD 值:

    HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\EnableExtensions

        及/或

    HKEY_CURRENT_USER\Software\Microsoft\Command Processor\EnableExtensions

到 0x1 或 0x0。使用者指定設定的執行優先順序高於電腦上的設定。命令
列參數的執行優先順序高於登錄中的設定值。


擴充命令包括下列命令的變更及(或)新增:

    DEL or ERASE
    COLOR
    CD or CHDIR
    MD or MKDIR
    PROMPT
    PUSHD
    POPD
    SET
    SETLOCAL
    ENDLOCAL
    IF
    FOR
    CALL
    SHIFT
    GOTO
    START (也包括援用外部命令之變更)
    ASSOC
    FTYPE

請鍵入 HELP 命令名稱,以查閱說明。

預設狀態下,不會啟用延遲環境變數擴充。您可以使用 /V:ON 或 /V:OFF 參數在
執行 CMD.EXE 時啟用或停用延遲擴充。您也可以用 REGEDIT.EXE 來修改以下
REG_DWORD 值,來啟用或停用整個電腦上或使用者登入工作階段中所有 CMD.EXE
的檔案名稱完整功能:

    HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\DelayedExpansion

        及/或

    HKEY_CURRENT_USER\Software\Microsoft\Command Processor\DelayedExpansion

其值可為 0x1 或 0x0。使用者指定設定的優先順序高於電腦設定。命令列參數
優先順序高於登錄設定值。

如果已啟用延遲環境變數擴充,驚嘆號字元會在執行時被用來取代環境變數值。

您可以為特定的 CMD.EXE 呼叫,以 /F:ON 或 /F:OFF 開關啟用或停用檔案
名稱完成。 您可以啟用或停用在同一部電腦上所有 CMD.EXE 的呼叫完成
及/或使用者登入工作階段。方法是使用 REGEDIT.EXE 設定其一或兩者登錄
中的 REG_DWORD 值:

    HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\CompletionChar
    HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\PathCompletionCha

        及/或

    HKEY_CURRENT_USER\Software\Microsoft\Command Processor\CompletionChar
    HKEY_CURRENT_USER\Software\Microsoft\Command Processor\PathCompletionChar

用於特定功能的控制字元十六進位值 (例如 0x4 是 Ctrl-D 以及 0x6 是
Ctrl-F)。使用者指定設定的執行優先順序高於電腦上的設定。命令列參數
的執行優先順序高於登錄中的設定值。

如果以 /F:ON 開關啟用完成,則用於目錄名稱完成的控制字元是 Ctrl-D
而用於檔案名稱完成的控制字元是 Ctrl-F。如果您要停用在登錄中的特定
完成字元,請使用空間值 (0x20),因為它不是正確的控制字元。

當您鍵入其中一個控制字元後,完成功能會被啟動。如果路徑字串已存在,
而且所建立的路徑清單也符合的話,完成函數會讀取到指標所在左方為止
的路徑字串。然後它會顯示第一個符合的路徑。如果找不到符合的路徑,
它會發出嗶聲並保留顯示。如果您重覆按相同的控制字元,它將在符合的路
徑清單中循環執行。如果您同時按下 Shift 鍵與控制字元,可在清單中反
向移動。如果您進行編輯後再按控制字元的話,已儲存的符合路徑清單會被
丟棄,並建立新的清單。如果您在檔案及目錄完成功能之間切換,會有同樣
的情況發生。這兩個控制字元不同之處是:檔案完成字元可同時對應檔案及
目錄名稱,而目錄完成字元只能對應目錄名稱。如果您將檔案完成功能用在
內建目錄命令上 (CD,MD 或 RD) 也等於使用了目錄完成功能。

如果您在路徑字串兩端加上引號,完成功能鍵就可正確處理包含空格或其他
特殊字元的檔案名稱。還有,如果您備份後,又在命令列中呼叫完成功能的
話,已呼叫過完成功能的指標右方的文字會被丟棄。

要求加上引號的特殊字元有:
     
     &()[]{}^=;!'+,`~

2012/02/06

Smash Mouth - All Star



Somebody once told me the world is gonna roll me
I ain't the sharpest tool in the shed
She was looking kind of dumb with her finger and her thumb
In the shape of an "L" on her forehead

Well the years start coming and they don't stop coming
Fed to the rules and I hit the ground running
Didn't make sense not to live for fun
Your brain gets smart but your head gets dumb
So much to do so much to see
So what's wrong with taking the back streets
You'll never know if you don't go
You'll never shine if you don't glow

[Chorus]
Hey now you're an All Star get your game on, go play
Hey now you're a Rock Star get the show on get paid
And all that glitters is gold
Only shooting stars break the mold

It's a cool place and they say it gets colder
You're bundled up now but wait 'til you get older
But the meteor men beg to differ
Judging by the hole in the satellite picture
The ice we skate is getting pretty thin
The water's getting warm so you might as well swim
My world's on fire how about yours
That's the way I like it and I never get bored

[Chorus x2]

Somebody once asked could I spare some change for gas
I need to get myself away from this place
I said yep what a concept
I could use a little fuel myself
And we could all use a little change

Well, the years start coming and they don't stop coming
Fed to the rules and I hit the ground running
Didn't make sense not to live for fun
Your brain gets smart but your head gets dumb
So much to do, so much to see
So what's wrong with taking the back streets
You'll never know if you don't go
You'll never shine if you don't glow

[Chorus x2]