Forums before death by AOL, social media and spammers... "We can't have nice things"
|    alt.msdos.batch    |    Fun with MS-DOS batch files    |    42,547 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 40,640 of 42,547    |
|    foxidrive to Todd    |
|    Re: run as administrator question    |
|    11 May 13 15:23:58    |
   
   From: not@this.address.invalid   
      
   On 11/05/2013 14:10, Todd wrote:   
   > On 05/10/2013 09:01 PM, foxidrive wrote:   
   >> On 11/05/2013 10:56, Todd wrote:   
   >>>   
   >>> Currently in W7, if I want to run command from a   
   >>> command prompt as "administrator", I have to go   
   >>> to the start orb, type in "cmd" (no return) and   
   >>> right click on the resulting "cmd" and "run as   
   >>> administrator".   
   >>>   
   >>   
   >> I call this one admin.bat and it gives me an Admin cmd prompt in Win 8.    
   You may get a UAC prompt but I   
   >> have that disabled.   
   >>   
      
   > Hi Foxidrive,   
   >   
   > I so don't understand. There is a double and a tripple   
   > quote on the two %file% commands. I always disable UAC   
   > too. So what would the command line be?   
   >   
   > Confused,   
   > -T   
      
   You quoted the message so there were more > characters. But look here with   
   leading spaces.   
      
      
    @echo off   
    if not "%~1"=="" goto :start   
    :getfile   
    set "file=%temp%\%random%.file.vbs"   
    if exist "%file%" goto :getfile   
      
    >"%file%" echo Set UAC = CreateObject("Shell.Application")   
    >>"%file%" echo UAC.ShellExecute "%~f0", "%cd%", "", "runas", 1   
    start "" "%file%"   
    goto :EOF   
      
    :start   
      
    cmd /k "cd /d "%*"&echo Admin:"   
      
      
      
      
      
      
   --   
   foxi   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca