nss Posted January 13, 2017 Posted January 13, 2017 Hi all. I am creating an app that runs a program with the admin privileges using the shellexecute's run as verb, but what my problem is, that no matter what I use to launch the program, it doesn't quite work like the run dialog would (certain programs don't get found, etc.). I've tried using the explorer.exe and passing the program to it, that is unreliable and opens documents folder sometimes instead, I've tried using the @comspec /c and that works better, but still some of the programs aren't being found that would be with the run dialog e.g., if I do @comspec /c diskpart it won't find it, I've even tried setting the working dir, but still no luck. I also tried passing commandline params to C:\WINDOWS\system32\rundll32.exe shell32.dll,#61, but no luck. can anyone help me what way to go in order to be able to launch programs in the run dialog style? is there a function in winapi that run dialog uses that I could use as well? Or what would be the best way to go about this? Any help much appreciated.
Moderators JLogan3o13 Posted January 13, 2017 Moderators Posted January 13, 2017 ShellExecute works just fine for things like DiskPart. Have you tried that on the other apps you're having trouble with? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
careca Posted January 14, 2017 Posted January 14, 2017 (edited) This used to work for me, but now i guess that windows 10 has something to do with it.. expandcollapse popup#include <Constants.au3> Local $dif ListLetter() Func ListLetter() ProgressOn('Diskpart', 'Working', '', 300, 300) ProgressSet(25, '', 'Working...') $DSK = Run('diskpart', '', @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD) ;$DSK = ShellExecute('diskpart', $STDIN_CHILD + $STDOUT_CHILD, '', '', @SW_HIDE) ConsoleWrite('$DSK - ' & @error & ' - ' & @MSEC & @CRLF) $begin = TimerInit() Do If $dif >= 3000 Then MsgBox(64, 'Params', 'Timeout') ExitLoop EndIf $dif = TimerDiff($begin) ProgressSet(35, '', 'Working...') $Read = StdoutRead($DSK, True, False) $Str = StringInStr($Read, 'DISKPART>') Until $Str <> 0 ProgressSet(65, '', 'Working...') StdinWrite($DSK, "list volume" & @CRLF) $begin = TimerInit() Do If $dif >= 3000 Then MsgBox(64, 'Params', 'Timeout') ExitLoop EndIf $dif = TimerDiff($begin) $Read = StdoutRead($DSK, True, False) $Str1 = StringInStr($Read, 'DISKPART>', 0, 2) Until $Str1 <> 0 ProgressSet(85, '', 'Working...') $Read = StdoutRead($DSK, True, False) ProgressOff() MsgBox(4096, "Diskpart - List Volume", $Read) EndFunc ;==>ListLetter Looks like diskpart is different from regular console. Edited January 14, 2017 by careca Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now