Results 1 to 7 of 7

Thread: Unable to Remove Directory [SOLVED]

  1. #1

    Thread Starter
    Member Skittles's Avatar
    Join Date
    Feb 2011
    Location
    New Mexico, USA
    Posts
    42

    Unable to Remove Directory [SOLVED]

    I'm so confused.

    My install program (running as Admin) can make a directory inside the Program Files (x86) directory.

    The software I put inside (running as Admin) works fine.

    Then while running my software (as Admin), I'm using the ShellExecute function with the "RunAs" operation to start my Uninstall. I do not get another User Account Control verification request because the software already has it.

    But when I use the RMDIR I get Path/File Access Error when I delete the folder I initially created.

    I've tried using a batch file (With Admin Rights), the Shell command, the ShellExecute command. and an ExecCmd routine I found online.

    I currently have an example program that makes and deletes a "Testing" folder. Without Admin Rights, I get the error. With those Rights, it's working just fine.

    I've never encountered this before, any ideas on what I'm missing?

    Thanks for your time,
    Joe
    Last edited by Skittles; Sep 10th, 2021 at 06:38 PM. Reason: [SOLVED]

  2. #2
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: Unable to Remove Directory

    Does the folder have files or sub folders in it?

  3. #3

    Thread Starter
    Member Skittles's Avatar
    Join Date
    Feb 2011
    Location
    New Mexico, USA
    Posts
    42

    Re: Unable to Remove Directory

    No files or folders.
    I remove all files from it. Then execute a Sleep 1000 before the RMDIR.
    My only guess is the program that makes folder is the only one that can delete them?
    Does VB6 have Permission capabilities?

  4. #4

    Thread Starter
    Member Skittles's Avatar
    Join Date
    Feb 2011
    Location
    New Mexico, USA
    Posts
    42

    Re: Unable to Remove Directory

    I don't have a DoEvents command between the file removal and the folder removal... let me try that.
    EDIT: Nope, that's not it.
    Last edited by Skittles; Sep 9th, 2021 at 07:56 AM.

  5. #5
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    4,418

    Re: Unable to Remove Directory

    Quote Originally Posted by Skittles View Post
    Then while running my software (as Admin), I'm using the ShellExecute function with the "RunAs" operation to start my Uninstall. I do not get another User Account Control verification request because the software already has it.

    But when I use the RMDIR I get Path/File Access Error when I delete the folder I initially created.

    I've tried using a batch file (With Admin Rights), the Shell command, the ShellExecute command. and an ExecCmd routine I found online.

    I currently have an example program that makes and deletes a "Testing" folder. Without Admin Rights, I get the error. With those Rights, it's working just fine.

    I've never encountered this before, any ideas on what I'm missing?

    Thanks for your time,
    Joe
    So you're running your Software inside that folder to start an uninstall, which should end by removing the Folder.... Let's see if you catch my drift.

    btw: Why not use SHFileOperation-API to nuke the whole folder incl. Files within?

    If it's a "Sub-Folder" for database, config, whatever: Never use "Program Files".
    Use AppData\Local of the User (User-Centric).
    Or just install it to "c:\MyProgramName"
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  6. #6

    Thread Starter
    Member Skittles's Avatar
    Join Date
    Feb 2011
    Location
    New Mexico, USA
    Posts
    42

    Re: Unable to Remove Directory

    Quote Originally Posted by Zvoni View Post
    So you're running your Software inside that folder to start an uninstall, which should end by removing the Folder.... Let's see if you catch my drift.

    btw: Why not use SHFileOperation-API to nuke the whole folder incl. Files within?
    I'm not familiar with that. Besides, I like verification the files deleted.

    If it's a "Sub-Folder" for database, config, whatever: Never use "Program Files".
    No, it's not. It is a "File Manager" program located in C:\Program Files (x86)\LFM"

    Use AppData\Local of the User (User-Centric).
    Doesn't apply

    Or just install it to "c:\MyProgramName"
    Because this is being used on other peoples computers.

    I think the problem is I have one program making the folders and another program (in a different folder) trying to delete a folder without "proper" permission.

    I may have to put my uninstaller in the same "installation folder". The batch files have no problem deleting themselves AND the folder they are IN.

    Thank you for your time, it's not wasted. I'll look into the "SHFileOperation-API" you mentioned.

  7. #7

    Thread Starter
    Member Skittles's Avatar
    Join Date
    Feb 2011
    Location
    New Mexico, USA
    Posts
    42

    Re: Unable to Remove Directory [SOLVED]

    SOLUTION:
    After two days of brain numbing troubleshooting, I figured it out.

    There's a limitation of SHELL with Admin.

    Running a program with Admin and then Shelling with Admin works.

    I was attempting a three level SHELL. My Main software SHELLed to my Uninstall which Shelled to a batfile. That doesn't work.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width