Search code examples
c#scriptingcs-script

Start CS-Script as administrator


I have some CS-Script with a complex logic, need to start that script as administrator. I tried to add

//css_npp asadmin

to the beginning of the script file, it doesnt work, so maybe i do something wrong. Main point is that i need to specify administrator privileges in the script file, not outside. Any ideas?


Solution

  • Well, i found a solution.

    First, you need to be sure that in "cs-script/Lib" or in "yourScriptFolder" there is a file "Elevate.cs". If its not download it from here CS-Script (cs-script.ExtensionPack.7z, it will be on the Lib folder), and put the file into the "Lib" folder or into "yourScriptFolder".

    Second, write in the beginning of your file

    //css_inc Elevate.cs;
    //css_pre elevate();
    

    And it will work!