Ask a questionAsk a question
 

Answer"del" command on the command line is not working

  • Tuesday, November 03, 2009 7:03 PMjfahelp Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hello -

    I have a simple package, no source files, that has a program that executes:

    del \"%USERPROFILE%\\Desktop\\ABC Applications\\NuView Benefits Meeting 2009*.*\"

    It's failing with the following info in execmgr...any insight?  I added a start in directory without success.



    Verifying content availability for package FDL00059 optional program Icon Removal - NuView Benefits Meetings 2009 execmgr 11/3/2009 12:59:21 PM 2952 (0x0B88)

    Validating chain of dependent programs for package FDL00059 optional program Icon Removal - NuView Benefits Meetings 2009 execmgr 11/3/2009 12:59:21 PM 2756 (0x0AC4)

    Validating package FDL00059 program Icon Removal - NuView Benefits Meetings 2009 in the chain. The content request ID is {B6174EDA-1E5E-4A85-AA3B-CBB4729158FC} execmgr 11/3/2009 12:59:21 PM 2756 (0x0AC4)

    Creating an optional execution request for package FDL00059 program Icon Removal - NuView Benefits Meetings 2009  execmgr 11/3/2009 12:59:21 PM 2756 (0x0AC4)

    Executing program del "%USERPROFILE%\Desktop\ABC Applications\NuView Benefits Meeting 2009*.*" /Q in User context execmgr 11/3/2009 12:59:21 PM 2756 (0x0AC4)

    Execution Request for package FDL00059 program Icon Removal - NuView Benefits Meetings 2009 state change from NotExist to NotifyExecution execmgr 11/3/2009 12:59:21 PM 2756 (0x0AC4)

    Execution Manager timer has been fired. execmgr 11/3/2009 12:59:21 PM 2888 (0x0B48)

    GetFileVersionInfoSize failed for file \del, error 1812 execmgr 11/3/2009 12:59:21 PM 2756 (0x0AC4)

    Executing program as a script execmgr 11/3/2009 12:59:21 PM 2756 (0x0AC4)

    Invalid executable file del execmgr 11/3/2009 12:59:21 PM 2756 (0x0AC4)

    Raising event:
    [SMS_CodePage(437), SMS_LocaleID(1033)]
    instance of SoftDistProgramBadEnvironmentEvent
    {
     AdvertisementId = "FDL20087";
     ClientID = "GUID:F4E064C0-1235-4AA3-8E93-A80CEC24FEC4";
     CommandLine = "del \"%USERPROFILE%\\Desktop\\ABC Applications\\NuView Benefits Meeting 2009*.*\" /Q";
     DateTime = "20091103185921.993000+000";
     DriveLetter = "";
     MachineName = "SNAPSHOT";
     PackageName = "FDL00059";
     ProcessID = 228;
     ProgramName = "Icon Removal - NuView Benefits Meetings 2009";
     SiteCode = "FDL";
     ThreadID = 2756;
     Win32ErrorCode = 2147942402;
     WorkingDirectory = "C:\\Documents and Settings\\user\\Desktop\\ABC Applications";
    };
     execmgr 11/3/2009 12:59:21 PM 2756 (0x0AC4)
    Raised Program Bad Environment Event for Ad:FDL20087, Package:FDL00059, Program: Icon Removal - NuView Benefits Meetings 2009 execmgr 11/3/2009 12:59:22 PM 2756 (0x0AC4)
    EnterRsRuningState failed to run script del "%USERPROFILE%\Desktop\ABC Applications\NuView Benefits Meeting 2009*.*" /Q 0x80009106 execmgr 11/3/2009 12:59:22 PM 2756 (0x0AC4)
    OnOptionalExecutionRequest failed at EvaluateRequestForExecution execmgr 11/3/2009 12:59:22 PM 2756 (0x0AC4)

    OnOptionalExecutionRequests failed for program Icon Removal - NuView Benefits Meetings 2009  execmgr 11/3/2009 12:59:22 PM 2756 (0x0AC4)

Answers

All Replies

  • Tuesday, November 03, 2009 7:33 PMEric C. MattoonMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Need to preface the command in the script with cmd.exe /c, so you should change to:

    cmd.exe /c del \"%USERPROFILE%\\Desktop\\ABC Applications\\NuView Benefits Meeting 2009*.*\"
  • Wednesday, November 04, 2009 3:04 AMjfahelp Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thanks for the help!

    Strange that "xcopy" works without specifying cmd.exe /c though....does that behave different somehow?

    Thanks again.
  • Wednesday, November 04, 2009 8:18 AMTorsten [MVP]MVP, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Proposed Answer
    Keep in mind that %userprofile% will be substituted with the value for SYSTEM's userprofile variable (when running with admin rights).

    xcopy.exe works without "cmd /c" because it's an .exe present on the computer itself (it can be found in%windir%\system32). You won't find something like del.exe on your system, because it's part of the command shell (cmd.exe).
    • Proposed As Answer byGarth JonesMVPWednesday, November 04, 2009 2:16 PM
    •  
  • Wednesday, November 04, 2009 10:46 AMjfahelp Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    That makes perfect sense, thanks for the information!

    And yes, we use %userprofile% only when user is logged in, running with user rights....primarily used to create/delete icons for our spoon-fed users :)