windows - BATCH Preventing users from opening file from outside the program? -


i have plugin system on program written in batch, follows; (thanks https://stackoverflow.com/users/3536342/davidpostill)

:plugindragon echo. echo plugins echo ============== dir /b plugins\*.cmd echo. echo enter name of plugin want run. set /p plugin=root/plugins/plugin_dragon.jr@root:~$  start "" plugins\%plugin% goto root 

is there way prevent users of program opening said plugins without running plugindragon script? in can't directly go plugins folder , double click applications (as they're written in batch). they'd need use "terminal" window open them, , that.

here modification of script following:

  • makes files hidden , system files using attrib
  • changes permissions on files make them unopenable using icacls

    :plugindragon echo. echo plugins echo ============== dir /b plugins\*.cmd echo. echo enter name of plugin want run (exclude extension). set /p plugin=root/plugins/plugin_dragon.jr@root:~$   :: grant permission access file     icacls "plugins\%plugin%.cmd" /grant everyone:f /t /c /q>nul 2>&1  :: unhide file     attrib -h -s -r -a "plugins\%plugin%.cmd" >nul  start /wait "" plugins\%plugin%.cmd  :: hide file attrib +h +s +r +a "plugins\%plugin%.cmd" >nul  :: denies access file icacls "plugins\%plugin%.cmd" /deny everyone:f /t /c /q>nul 2>&1  goto root 

Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -