View unanswered posts | View active topics It is currently 01 Sep 2014 07:39



Post new topic Reply to topic  [ 5 posts ] 
gotadmin.vbs problem [solved] 
Author Message

Joined: 26 Oct 2011 22:38
Posts: 1007
Location: Egypt
Post gotadmin.vbs problem [solved]
i'm using this to run files with admin rights but it does't work here an example:
Code:
@echo off
cls
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\gotadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1  >> "%temp%\gotadmin.vbs"
start /min %ComSpec% /c "%temp%\gotadmin.vbs"
copy d:\1.txt c:\1.txt


the file is copied but it keep copying it and many cmd windows pop up and disappear

[!]
if u gona try it save your work first because you might want to logoff to stop the cmd windows


Last edited by abc0502 on 12 Mar 2012 00:30, edited 1 time in total.



10 Mar 2012 02:29
Profile

Joined: 10 Feb 2012 02:20
Posts: 4114
Post Re: gotadmin.vbs problem
Where did you get the code? It's running the batch file again and again...

You can put the copy command in another batch file and replace %~s0 with the name of the second batch file.


10 Mar 2012 09:26
Profile

Joined: 26 Oct 2011 22:38
Posts: 1007
Location: Egypt
Post Re: gotadmin.vbs problem
the code was here i took it from here: http://www.dostips.com/forum/viewtopic.php?f=3&t=2790
i just took the code that i need "in case of limite privilage"

i already tried what u said but i was wondering if ther is another way but i guess i will use what you suggested.
thanks :)


10 Mar 2012 10:47
Profile

Joined: 10 Feb 2012 02:20
Posts: 4114
Post Re: gotadmin.vbs problem
You didn't include the code for

A) testing to see if admin privs are granted and
B) if so then jumping to a routine.


10 Mar 2012 15:02
Profile

Joined: 26 Oct 2011 22:38
Posts: 1007
Location: Egypt
Post Re: gotadmin.vbs problem
so the code doesn't work without the rest of it
i thought because i know that i need admin privilage so i just skipped the rest
because every time i copy somthing to C:\ it say access denyed
i tryed it again with the the rest of the code and it work fine, but i think i will use the vbs file to launch the bat as u said in your last post


11 Mar 2012 01:38
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 


Who is online

Users browsing this forum: Bing [Bot], penpen, Yahoo [Bot] and 16 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Forum style by Vjacheslav Trushkin for Free Forums/DivisionCore.