A VBScript UAC Problem

Author Message
VanDiZ

  • Total Posts : 4
  • Scores: 0
  • Reward points : 0
  • Joined: 1/11/2012
  • Status: offline
A VBScript UAC Problem Wednesday, January 11, 2012 6:18 AM (permalink)
0
[Helpful answer received] / [List Solutions Only]
Hello everyone, It is my first post to that forum.
bellow is a one line vbs code I made to get the UAC to run a program,
CreateObject("Shell.Application").Namespace(CreateObject("Scripting.FileSystemObject").GetParentFolderName (WScript.ScriptFullName)).ParseName("MyProgram.bat").InvokeVerb "RunAs"

it is working fine
Now the problem part, if I replace the "MyProgram.bat" with the "<any path>\MyProgram.bat" (e.g. C:\Users\username\Desktop\VBS.UAC\MyProgram.bat), the code do not works, it is not accepting any directory.
What can i do to make it working with a full path ???
can anyone help ???
please help...

Regards...
<message edited by VanDiZ on Wednesday, January 11, 2012 6:20 AM>
 
#1
    59cobalt

    • Total Posts : 969
    • Scores: 91
    • Reward points : 0
    • Joined: 7/17/2011
    • Status: offline
    Re:A VBScript UAC Problem Wednesday, January 11, 2012 6:28 AM (permalink)
    0
    Disable UAC?
     
    #2
      VanDiZ

      • Total Posts : 4
      • Scores: 0
      • Reward points : 0
      • Joined: 1/11/2012
      • Status: offline
      Re:A VBScript UAC Problem Wednesday, January 11, 2012 6:41 AM (permalink)
      0
      Thank you vary mutch 59cobalt for your replay,
       
      59cobalt

      Disable UAC?

       
      Unfortunately disabling the UAC is not an option for me.
      But thanks anyway for your replay 59cobalt
       
      I am looking for a way that the code can accept directory paths also.
       
       
      #3
        VanDiZ

        • Total Posts : 4
        • Scores: 0
        • Reward points : 0
        • Joined: 1/11/2012
        • Status: offline
        Re:A VBScript UAC Problem Thursday, January 12, 2012 7:37 PM (permalink)
        0
        hey experts, is no one here who can help me ???
         
        #4
          Wakawaka

          • Total Posts : 456
          • Scores: 23
          • Reward points : 0
          • Joined: 8/27/2009
          • Status: offline
          Re:A VBScript UAC Problem Friday, January 13, 2012 4:50 AM (permalink)
          5
          [This post was marked as helpful]
          What part are you changing?  If you are ONLY changing the "MyProgram.Bat" to reflect the full path then that would be why.
           
          You used the Namespace method which effectively returns a Folder object and the ParseName method works off that directory.  So if you use "C:\" for the namespace and then call the ParseName method it would actually look like you are saying "C:\C:\MyProgram.bat".
           
          #5
            VanDiZ

            • Total Posts : 4
            • Scores: 0
            • Reward points : 0
            • Joined: 1/11/2012
            • Status: offline
            Re:A VBScript UAC Problem Friday, January 13, 2012 7:27 AM (permalink)
            0
            Hey Wakawaka, thank you vary much buddy,
            you just saved my life,
            sometimes vary subtle things goes out of mind
            I was just about to recode from scratch my entire project
             
            Now that is the modified code bellow which is fully functional for me,
            CreateObject("Shell.Application").Namespace("<Full_directory_path\>").ParseName("MyProgram.bat").InvokeVerb "RunAs"

            Where the "Full_directory_path" can be any directory, e.g. C:\Program Files\xyz\abcd
             
            #6

              Online Bookmarks Sharing: Share/Bookmark

              Jump to:

              Current active users

              There are 0 members and 1 guests.

              Icon Legend and Permission

              • New Messages
              • No New Messages
              • Hot Topic w/ New Messages
              • Hot Topic w/o New Messages
              • Locked w/ New Messages
              • Locked w/o New Messages
              • Read Message
              • Post New Thread
              • Reply to message
              • Post New Poll
              • Submit Vote
              • Post reward post
              • Delete my own posts
              • Delete my own threads
              • Rate post

              2000-2012 ASPPlayground.NET Forum Version 3.9