call cmd
[1/5] from: john_kenyon::mlc::com::au at: 24-May-2002 10:04
Hi,
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.
Any ideas?
Thanks,
John
[2/5] from: james:mustard at: 24-May-2002 20:12
Hi John,
You could use a call to a windows .vbs file. With vbs files you can do
pretty much anything in windows 98/NT/ME/2K/XP - as such they can be a
two-edged sword in the hands of a malicious user ;-).
syntax: call myfile.vbs
(For windows 95 you will need the Windows Scripting Host installed.)
Terry Brownell on 31/03/2002 began a message thread on this entitled
[REBOL] Rebol/Windows Macro Maker - Autopilot.r
You can read messages in this thread on escribe at:
http://www.escribe.com/internet/rebol/m20971.html
http://www.escribe.com/internet/rebol/m20980.html
http://www.escribe.com/internet/rebol/m20991.html
http://www.escribe.com/internet/rebol/m20993.html
Regards,
James.
[3/5] from: tomc:darkwing:uoregon at: 24-May-2002 9:47
to not open a window 'usage says
--nowindow (-w) Do not open a window
On Fri, 24 May 2002 [john_kenyon--mlc--com--au] wrote:
[4/5] 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
[5/5] from: john_kenyon:mlc:au at: 27-May-2002 10:33
Gregg/James,
Thanks for the replies. I think I will give Greggs idea a go as it seems a
little cleaner. Surprising how easy it is to access dlls from /view.
Cheers,
John