Four Js Development Tools Forum

Discussions by product => Genero BDL => Topic started by: Snorri B. on March 11, 2014, 04:50:12 pm



Title: Deleting file on the client
Post by: Snorri B. on March 11, 2014, 04:50:12 pm
Hi.

I am trying to delete a file on the client workstation using frontcall. It always fails.

the value of delstr is
del C:\Users\Snorri\AppData\Local\Temp\prentarar.pdf

The call is:
call ui.interface.frontCall("standard","execute",[delstr,1],[ret])

If I execute the displayed del command in Command Prompt on the client workstation it works fine. Any thoughts?

Best regards,
-Snorri


Title: Re: Deleting file on the client
Post by: Lionel F. on March 11, 2014, 05:53:16 pm
Hi Snorri,

"execute" works with executable programs, not with command lines. So you have to execute "cmd.exe" and then pass the command line.

The value of your delstr variable should be something like :
cmd /C del C:\\Users\\Snorri\\AppData\\Local\\Temp\\prentarar.pdf

You can use cmd.exe /? in order to see the list of cmd various available options.

Best regards,
Lionel


Title: Re: Deleting file on the client
Post by: Snorri B. on March 12, 2014, 11:33:09 am
Hi Lionel and thanks.

This works fine.
Maybe I could suggest that the manuals should be more verbose on this issue :)

Best regards,
-Snorri


Title: Re: Deleting file on the client
Post by: Lionel F. on March 12, 2014, 11:53:58 am
Hi Snorri,

The documentation says : "Executes a command on the workstation with or without waiting" ....indeed I agree it could be more verbose :)

A good pattern is to use commands that can be executed from the Windows startmenu (in the "execute" (Windows XP) or "search" field (Windows 7)). For instance if you type "del c:\tmp\myfile.txt", it will not work. But if you type "cmd /C del c:\tmp\myfile.txt" then it will.

Regards,
Lionel