Results 1 to 3 of 3

Thread: OS_SHELL - Strange results using WMIC

  1. #1

    OS_SHELL - Strange results using WMIC

    Hello,
    When I attempt to create a file containing a list of Windows Hotfixes using the WMIC command, I encounter the following error: Invalid XSL format (or) file name.

    If I paste the command that is placed on the clipboard by the script directly into a CMD dialog box, it works fine. Also, if I shorten the command to just
    wmic qfe list full /format:htable
    , this also works. Below is the script.

    Hoping someone can help.
    Cheers


    ' Create file containing list of Windows Hotfixes
    ' using the Windows Management Instrumentation Command (WMIC)
    ' command. This can produce and HTML file (cmdh) or a TXT file
    ' (cmdt).
    
    Uses "OS"
    
    Dim wm As String Value "wmic qfe list full "
    
    Dim h1 As String Value "/format:htable > "
    Dim h2 As String Value "%USERPROFILE%\hotfix.html"
    
    Dim t1 As String Value "/format:texttablewsys > "
    Dim t2 As String Value "%USERPROFILE%\hotfix.txt"
    
    Dim cmdh As String 
    Dim cmdt As String 
    
    cmdh = wm & h1 & $DQ & h2 & $DQ
    cmdt = wm & t1 & $DQ & t2 & $DQ
    OS_Shell(cmdh, %OS_WNDSTYLE_MAXIMIZED, %OS_SHELL_SYNC)
    ClipBoard_SetText(cmdh)
    MsgBox(0, cmdh)
    
    Last edited by ErosOlmi; 20-11-2014 at 16:16.

  2. #2
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    6,819
    Blog Entries
    3
    Rep Power
    695
    Hi Django,

    what about this version? It works okay on my PC, feel free to change the style to hidden window...
    Uses "OS", "File"
    
    String wm = "wmic qfe list full "
    
    String h1 = "/format:htable > "
    String h2 = "%USERPROFILE%\hotfix.html"
    
    String t1 = "/format:texttablewsys > "
    String t2 = "%USERPROFILE%\hotfix.txt"
    
    String cmdh = wm & h1 & $DQ & h2 & $DQ
    String cmdt = wm & t1 & $DQ & t2 & $DQ
    
    RunCommand(cmdh)
    
    Function RunCommand( sCommand As String )
    
      String tempBat = APP_SourcePath + "temp.bat"
      
      FILE_Save(tempBat, sCommand)
      
      OS_Shell(tempBat, %OS_WNDSTYLE_MAXIMIZED, %OS_SHELL_SYNC)
    
    End Function
    

    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 7 64bit - Intel Core 2 Duo T6600 @ 2.2GHz - 4 GB RAM - NVIDIA GeForce G210M 512MB
    Windows 8 64bit - Intel Core i5-3350P @ 3.1GHz - 8 GB RAM - NVIDIA GeForce GT640 3GB

  3. #3
    Excellent Petr, Thank you.
    I'm still puzzled by the issue I encountered in the original script, but oh well.
    Cheers.

Similar Threads

  1. TBGL_EntitySetFOV gives strange results
    By ReneMiner in forum TBGL General
    Replies: 4
    Last Post: 20-03-2013, 19:09
  2. Help file: results of your efforts
    By ErosOlmi in forum Samples for help file
    Replies: 7
    Last Post: 30-05-2007, 17:23
  3. Speed Test Results
    By catventure in forum General
    Replies: 3
    Last Post: 17-10-2006, 19:04

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •