[REBOL] Re: call cmd
From: greggirwin:mindspring at: 24-May-2002 10:14
Hi John,
<< Is there any way of using call to run a command on a Windows based system
without opening a command prompt window.
I have tried every call refinement and starting from the command line with
rebol -cqs but still no luck. >>
CALL doesn't work, but you can call ShellExecute to do it.
win-shell: context [
win-lib: load/library %shell32.dll
execute: make routine! [
hwndParent [integer!]
Operation [string!]
File [string!]
Parameters [string!]
Directory [string!]
ShowCmd [integer!]
return: [integer!]
] win-lib "ShellExecuteA"
; Operation values
; "open"
; "print"
; "explore"
; ShowCmd values
; 0 Hides the window and passes activation to another window.
;
; 1 Activates and displays a window. If the window is minimized
; or maximized, Windows restores it to its original size and
; position (same as 9).
;
; 2 Activates a window and displays it as an icon.
;
; 3 Activates a window and displays it as a maximized window.
;
; 4 Displays a window in its most recent size and position. The
; window that is currently active remains active.
;
; 5 Activates a window and displays it in its current size and
; position.
;
; 6 Minimizes the specified window and activates the top-level
; window in the system's list.
;
; 7 Displays a window as an icon. The window that is currently
; active remains active.
;
; 8 Displays a window in its current state. The window that is
; currently active remains active.
;
; 9 Activates and displays a window. If the window is minimized
; or maximized, Windows restores it to its original size and
; position (same as 1).
]
win-shell/execute 0 "open" "notepad.exe" "" "" 1
HTH!
--Gregg