Skip to main content

Activate OS Command on Win Server 2008

Author: sbpatel48@hotmail.com (Sandipp)

Hi,

I have the following code in a form.

activate "OS".command("cmd.exe /c dir/O:D/B c:\\ > c:\\check.txt")

 However, i can see the cmd.exe running in task manager.

Has anyone had the same problem, any help will be much appricated 

Rgds, Sandip

When this is run on Window Server 2008. The application exits immediatley without any errors. And the OS command is not executed.

Activate OS Command on Win Server 2008

Author: sbpatel48@hotmail.com (Sandipp)

Hi,

I have the following code in a form.

activate "OS".command("cmd.exe /c dir/O:D/B c:\\ > c:\\check.txt")

 However, i can see the cmd.exe running in task manager.

Has anyone had the same problem, any help will be much appricated 

Rgds, Sandip

When this is run on Window Server 2008. The application exits immediatley without any errors. And the OS command is not executed.

Hi,

cmd.exe /c start %%PCmd

But

If you use Uniface 9, you have some functions for the manipulation of files

$ldirlist,...


and if it's also necessary, you can create a component where the operation is like

operation comandeOS
params
    String  PCmd   : IN  ; Commande OS à exécuter
    Boolean POut   : IN  ; Nécéssiter d'obtenir le résultat de la commande OS
    Boolean PSync  : IN  ; Synchrone ou non
    Boolean PShell : IN  ; Nécessité de lancer le shell en plus de la commande fournie
    String  PRes   : OUT ; Résultat de la commande OS si besoin
endparams
    if (PShell = "T")
        PCmd = "cmd.exe /c start %%PCmd"
    endif
    if (POut = "T")
        if (PSync = "T")
            activate/sync "cx0ossx".commandout(PCmd, PRes)
        else
            activate/async "cx0ossx".commandout(PCmd, PRes)
        endif
    else
        if (PSync = "T")
            activate/sync "cx0ossx".command(PCmd)
        else
            activate/async "cx0ossx".command(PCmd)
        endif
    endif
end ; comandeOS
 

Bye

Antoine


Author: apicaud (antoine.picaud@free.fr)

Activate OS Command on Win Server 2008

Author: sbpatel48@hotmail.com (Sandipp)

Hi,

I have the following code in a form.

activate "OS".command("cmd.exe /c dir/O:D/B c:\\ > c:\\check.txt")

 However, i can see the cmd.exe running in task manager.

Has anyone had the same problem, any help will be much appricated 

Rgds, Sandip

When this is run on Window Server 2008. The application exits immediatley without any errors. And the OS command is not executed.

I suspect you have a signature "OS" which points at a 32 bit program, and the 2008 is a 64 bit. Have you looked at "spawn" instead?


Author: Iain Sharp (i.sharp@pcisystems.co.uk)

Activate OS Command on Win Server 2008

Author: sbpatel48@hotmail.com (Sandipp)

Hi,

I have the following code in a form.

activate "OS".command("cmd.exe /c dir/O:D/B c:\\ > c:\\check.txt")

 However, i can see the cmd.exe running in task manager.

Has anyone had the same problem, any help will be much appricated 

Rgds, Sandip

When this is run on Window Server 2008. The application exits immediatley without any errors. And the OS command is not executed.

Hi Sandip, Still a problem? Or did you fix it? Do you run uniface.exe (desktop) or urouter.exe (server)? Perhaps it has something to do with rights. Does the user has rights to start the cmd? Or write to c:\\? As far as I know a regular user can not do something with or in c:\\. Please check this. You could try 'cmd /K'. This will leave you with a doscommand box. This might help you find the error. cmd.exe /K dir/O:D/B c:\\ > c:\\check.txt Also you could try to catch the error of the dos command. THis helped me a lot. Just add '2> file' to your command. Make sure you can write in c: :) cmd.exe /K dir/O:D/B c:\\ > c:\\check.txt 2> c:\\error.txt THis wil create a error.txt with the error message in it. Better use another directory, is there a d:? Or use a c:\\temp Succes! Peter


Author: lammersma (lammersma@hotmail.com)