KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Permissions Error When using System Document Commands
PRODUCT: 4D | VERSION: 15.x | PLATFORM: Win
Published On: December 29, 2016

When using the some commands under the system documents family of commands, such as DELETE FOLDER or DELETE DOCUMENT, a syntax error may be generated explaining that there is a permissions error.


This may be due to the file(s) requiring elevated privaledges to perform the action. An easy way to work around this issue is to run the 4D application in administrative mode. This can be done automatically by modifying the properties of the shortcut or executable:


It can also be done on a per open basis by right clicking the executable and selecting Run as administator:


Below is a method that will automatically toggle the setting in the properties of the currently running 4D application and restart it.

C_TEXT($in;$out;$err)
$in:=""
SET ENVIRONMENT VARIABLE("_4D_OPTION_HIDE_CONSOLE";"true")
$string:="reg.exe Add \"HKCU\\Software\\Microsoft\\Windows NT\\"
$string:=$string+"CurrentVersion\\AppCompatFlags\\Layers\"/v\""
$string:=$string+Application file
$string:=$string+"\"/d\"RUNASADMIN\" /f"
LAUNCH EXTERNAL PROCESS($string;$in;$out;$err)