Deleting file on the client

Started by Snorri B., March 11, 2014, 04:50:12 PM

Previous topic - Next topic

Snorri B.

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

Lionel F.

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

Snorri B.

Hi Lionel and thanks.

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

Best regards,
-Snorri

Lionel F.

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