On Windows 7, when I used process_create/3 in SWI Prolog to open an application like Notepad.exe, the notepad opens. However, it doesn't work for applications that use command prompt. As an example, when I tried to open the command prompt window, using:
main :- process_create('C:\\WINDOWS\\system32\\cmd.exe',[] ,[]).
which gives an
ERROR: Process "c:\windows\system32\cmd.exe": exit status: 1
Similarly, when trying it to open powershell.exe, it doesn't work either. the console just hangs, without displaying an error.
Any help is greatly appreciated.
process_create/3is used for running a non-interactive program once. If you want to switch focus you might want to read carefully through all of the options you can pass toprocess_create/3. - user1812457win_exec/2and it works too(including passing parameters to it). But I wanted to run it usingprocess_create/3passing arguments to it by passing them in theArgslist as explained in the documentation. However, it doesn't work. So I tried to open Notepad.exe and cmd.exe to see how it works, as explained above. Any idea on how to make it work? Thanks. - shujinwin_exec/2. I don't use Windows so the best I can do to help you is to read the documentation more carefully than you ;) but it seems thatprocess_create/3is not as useful aswin_exec/2for Windows. Don't take my word though. - user1812457