Microsoft Developer Network > Forums Home > Windows Embedded Standard Forums > Standard 2009: Embedded Enabling Features (EEFs) > Launch command-line utility from DUA without showing a CMD.EXE win

Answered Launch command-line utility from DUA without showing a CMD.EXE win

  • Thursday, October 01, 2009 6:39 PM
     
      Has Code
    Various things needed done during a DUA update script have called for running a console mode .exe (for example, a vendor-supplied BIOS update program).
    
    Our Minlogon XPe image uses a custom app as the shell, so does not have explorer or cmd.exe running.  The image boots via a script configured to run for userinit, and it manages whether or not the system boots into the application based on if a DUA update is in progress or not... amongst other things.  It works great, except I have issues with DUA running things.
    
    It seems frequently necessary to use DUA EXECUTEPROCESS to launch cmd.exe, and supply arguments to it that launch a console app because it will not work otherwise.  That puts up a DOS box window... not something I like at all though on the unit all keys you could use to mess with the system are 
    disabled (Ctrl/Alt,SysReq,Break, etc).
    
    I've tried using vbscripts (WshShell.Run/Exec methods), but still seem to need to use cmd.exe to launch cscript or wscript.  Color me stymied.
    
    Does anyone have any thoughts about how to get DUA to run stuff without popping up a console window that screams "C:\WINDOWS\system32\cmd.exe" in the title bar?  Is there a way to make DUA run cmd.exe full-screen with no frame?

Answers

  • Monday, October 19, 2009 1:05 PM
     
     Answered

    The answer apparently lies in the dreaded startupinfo field of the EXECUTEPROCESS command.  The following command launches the .exe without showing a cmd window.  I presume it possibly relates to the avoidance of specifying the "WinSta0\Default" desktop name string, but I do not really know, except that this is the first time I was able to make it work.  Could it be that it with minlogon it has to use the system account?  I doubt that it has to do with the DASTARTF_RUNFULLSCREEN or with the 0 window attribute values or showwindows since those values are probably defaulting to 0 if missing.  I guess to know for sure, more experimentation is needed, but I'll post this in
    case it helps someone else.

    Windows XP Embedded Advanced book could do a lot better than it does in this area.  The book seems to strongly imply you need to use the "WinSta0\Default" and there is only one small reference to use of a system account when it is missing.  Furthermore, the explanation of the startupinfo is skimpy... not describing many of the values.

    // Command                : 15          EXECUTEPROCESS
    // [ErrorMode]            : DAERH_ABORT Abort DUA program on error
    // [RebootOK]             : DANO        System will not reboot
    // [ExpandMode]           : DANO        Do not expand variables in next string
    // [ApplicationName]      : c:\tools\my.exe
    // [ExpandMode]           : DANO        Do not expand variables in next string
    // [CommandLine]          : --args
    // [WaitForCompletion]    : DAYES       Wait for completion of command
    // [Timeout]              : 4294967295  Infinite time delay
    // [InheritHandles]       : DANO        Do not inherit handles from caller
    // [SecRev]               : DASEC_REV   ?DASEC_REV = 1?
    // [InheritHandles]       : DANO        Do not inherit handles from caller
    // [ExpandMode]           : DANO        Do not expand variables in next string
    // [ProcSecAttrib]        :             >
    // [SecRev]               : DASEC_REV   ?DASEC_REV = 1?
    // [InheritHandles]       : DANO        Do not inherit handles from caller
    // [ExpandMode]           : DANO        Do not expand variables in next string
    // [ThreadSecAttrib]      :             ?
    // [CreationFlags]        :             Do not customize process creation
    // [ExpandMode]           : DAYES       Expand variables in next string
    // [CurrentDirectory]     : %APPDRIVE%\update\DUA_cmd\Files
    // [StartupInfo/NewEnv]   : 1           StartupInfo=1; Liming B.3.2 Pg 647-649
    //   [ExpandMode]         : DANO        Do not expand variables in next string
    //   [Desktop_name]       :             Blank = System; WinSta0\Default = User?
    //   [ExpandMode]         : DANO        Do not expand variables in next string
    //   [title_string]       :             Do not assign a window title
    //   [X_loc]              : 0           Window origin
    //   [Y_loc]              : 0              "     "
    //   [X_size]             : 0           Window size
    //   [Y_size]             : 0              "     "
    //   [X_CountChars]       : 0           Window ?Countchars?
    //   [Y_CountChars]       : 0              "     "
    //   [FillAttributes]     : 0           Window Background/Foreground
    //   [StartFlags]         : 32          DASTARTF_RUNFULLSCREEN
    //   [ShowWindows]        : 0           Do not show windows?
    //   [ExpandMode]         : DANO        Do not expand variables in next string
    //   [StdInStream]        :                  ?
    //   [ExpandMode]         : DANO        Do not expand variables in next string
    //   [StdOutStream]       :                 ?
    //   [ExpandMode]         : DANO        Do not expand variables in next string
    //   [StdErrStream]       :                  ?

    EXECUTEPROCESS,DAERH_ABORT,DANO,DANO,c:\tools\my.exe,DANO,--args,DAYES,4294­967295,DANO,DASEC_REV,DANO,DANO,,DASEC_REV,DANO,DANO,,,DAYES,%APPDRIVE%\upd­ate\DUA_cmd\Files,1,DANO,,DANO,,0,0,0,0,0,0,0,32,0,DANO,,DANO,,DANO,

    • Marked As Answer by Kevin Bulgrien Monday, October 19, 2009 3:40 PM
    •