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)
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>
|
|
|
|
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)
|
|
|
|
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)
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.
|
|
|
|
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)
hey experts, is no one here who can help me ???
|
|
|
|
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)
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".
|
|
|
|
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)
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
|
|
|
|