How to Pass String To Dos Environment
Posted on January 5, 2009
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | 'System & API - How to Pass String To Dos Environment Private Sub Main() 'To open a DOS window Shell ("command.com"), vbNormalFocus 'clear the clipboard Clipboard.Clear 'Copy the string you want to pass to the Dos Environment, including the Enter key (Chr$(13) = Enter Key) Clipboard.SetText "Dir *.*" + Chr$(13) 'set the focus to the Dos window. "MS-DOS Prompt" AppActivate "MS-DOS Prompt" 'use the "SendKeys" function to send the string from the clipboard to the DOS Environment SendKeys "% ep", 1 End Sub |