VideoHelp Forum
+ Reply to Thread
Results 1 to 7 of 7
Thread
  1. Member vhelp's Avatar
    Join Date
    Mar 2001
    Location
    New York
    Search Comp PM
    So I wrote a drive letter changer app (for flash drives) after this final last straw I was forced to deal with, every time I insert the same flash drive (FD) into my laptop. Sometimes it would stay the same drive letter and sometimes not. I guess the confusion occurs when I insert a flash drive or mem stick, similar or otherwise, it was hit or miss. The point is, I have certain project files and scripts on one fd where in the script I made several hard-coded drive/folder locations. And when the drive letter changes on the actual fd, nothing works properly or at all. I've been wanting to write something up myself so that I would not have to remember that app, you know, computer management, navigate to where I have to perform the task and wait for drives to be read and presented to me for change. The app I wrote eliminates all that and I can swap/change/fix the fd instantly.

    So, running w/out first calling "run as administrator" rights, seem to work for Computer Management.

    Is there a way to call or invoke admin rights so that the app can run without my having to run the app via right-click/select 'run as admin' ?

    Quote Quote  
  2. Member
    Join Date
    Aug 2006
    Location
    United States
    Search Comp PM
    I only know about one method that runs programs with administrator privileges every time.

    1. Log in with an administrator account.
    2. Right-click on the Start menu icon or the executable file.
    3. Click on "Properties" in the context menu.
    4. Click on the "Compatibility" tab in the Properties window.
    5. Check the box beside "Run this program as an administrator" (near the bottom of the window)
    6. Click "Change settings for all users" if you want to make it possible for all users to run the program with administrator privileges.
    7. Click the "OK" button at the bottom of the window.

    I'm not sure this will work with a portable program. I have only tried it with programs that I installed.
    Last edited by usually_quiet; 28th Dec 2016 at 01:48.
    Ignore list: hello_hello, tried, TechLord, Snoopy329
    Quote Quote  
  3. The proper way is to build your program with requestedExecutionLevel = requireAdministrator.

    Don't know what you're building with so can't help you there. In Visual Studio you probably find it in Property Pages\Configuration Properties\Linker\Manifest File. Change "UAC Execution Level" to requireAdministrator.

    You can change after the fact if you must, with a manifest-editor, but you might not be able to certify the executable then. If so usually_quiets solution is better although it doesn't follow the file if copied. It's then stored in the registry at either

    HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers

    depending on if you applied to current or all users.
    Quote Quote  
  4. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    There was a way to run a program in administrator mode without even being prompted for elevation. It had to do with windows tasks or jobs or something. I got it working at one point so it was possible, but I think I was using Windows 7 at the time.

    ...

    Um, if you give a flash drive a letter like "Q" or something it should reacquire that drive letter every time you plug it in. It should only be given another letter if another drive has claimed the letter in it's absence, so stick to the later letters in the alphabet and you should be fine, without needing that program or administrator privileges at all.
    Quote Quote  
  5. Member vhelp's Avatar
    Join Date
    Mar 2001
    Location
    New York
    Search Comp PM
    system specs: Delphi XE7 platform development

    Thanks everyone for your advice and suggestions so far. Much appreciated.

    I follow a usual pattern to minimize driver letter confusion. I keep one fd in one port and almost never remove it. same with another two fd's. but on rare occasions, i have to remove any one of them or all of them and that's when drive letters get rearranged, or when I throw in a 3-port or 4-port hub the drive letters get rearranged. sometimes it doesn't change the drive letter, but then sometimes it does. I can't explain why or how it does this nonsense, only that it does and when it does it drives me mad. Anyway. I have this tool and it works perfectly.

    Eventually I may share it with others if they find it useful. For that situation I would need to find the best method for making the app w/out admin rights requirements.

    I found this resource interesting but its difficult to follow. The steps are not easy for me to get it working. And I have no windows administration experience what-so ever.

    http://stackoverflow.com/questions/6226976/how-to-add-manifest-requestedprivileges-inf...delphi-project
    Quote Quote  
  6. Yes, that seems quite convoluted.

    You can also set run as admin on shortcuts, in the advanced options rather than the compability page. That will stay with the shortcut but requires the program to reside somewhere predictable of course.

    I would try to learn how to include a custom manifest with Delphi though.

    To look at, and in some circumstances edit, the manifest in a program you can use for instance Resource Hacker.
    Quote Quote  
  7. Member vhelp's Avatar
    Join Date
    Mar 2001
    Location
    New York
    Search Comp PM
    You can also set run as admin on shortcuts,
    yes, i have thought about that. it was my first idea before posting here for other methods. but i'm thinking bigger. if i have other apps that i write that require admin rights, then even this won't be practical. well, for my home pc, is one thing, but my work pc or friends, its another. and as a matter of fact, i just tried this app on my work pc and it does not work--because i am locked out of admin rights, i guess--"EOleException: Access is denied". and this was the other reason i wanted to create this app in the first place, and now i know i can't even use it on that pc. oh well. i tried. its not a big deal for my work pc. but it is on my personal pc's and laptops. so i will focus on that. i will look into the other (delphi method i linked to) suggestions further.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!