Cheers,
Jeff
Well that's the rub, isn't it? Over an hour and a half searching this forum, the help files and Google and I can't find a way to edit a custom button to open an elevated command prompt. If you know how, would you mind sharing? Thanks!SammaySarkar wrote:You can just replace the default cmd toolbar button with a custom button that runs an elevated cmdprompt. That's hardly scripting
Code: Select all
$comspec = ("%osbitness%" == 64) ? "%windir%\System32\cmd.exe" : "%windir%\SysWoW64\cmd.exe";
$cscript = ("%osbitness%" == 64) ? "%windir%\System32\cscript.exe" : "%windir%\SysWoW64\cscript.exe";
$vbsFile = "%TEMP%\~OpenElevatedCMD.vbs";
$vbsContent = <<<>>>
Set UAC = CreateObject("Shell.Application")
UAC.ShellExecute "$comspec", "/k pushd ""<curpath>""", "", "runas", 1
>>>;
writefile($vbsFile, trim($vbsContent));
if (get("trigger") == "1") { // LeftClick
run """$comspec"" /k pushd ""<curpath>""";
} elseif (get("trigger") == "2") { // RightClick
run """$cscript"" ""$vbsFile"" //nologo", , 0, 0;
}
Code: Select all
if (exists("<xyscripts>\elevcmd.vbs")!=1){
writefile("<xyscripts>\elevcmd.vbs",<<<#>>
set oArgs = WScript.Arguments
set oSh = CreateObject("Shell.Application")
oSh.ShellExecute "%COMSPEC%", "/k pushd " & """" & oArgs(0) & """", "", "runas"#>>);}
run "%WINDIR%\system32\cscript.exe ""<xyscripts>\elevcmd.vbs"" ""<curpath>""",,0,0;No. Because I didn't read all of your instructions carefully enough.highend wrote:You've right clicked my button (to get an elevated 64bit CMD)?