Category: Scripting


Quicktip: BASH (Shell) script – show duration/time taken to execute script

Simple BASH script example for showing the elapsed time for a script to execute:


start_time=`date +%s`

end_time=`date +%s`

echo "Script execution took $time_elapsed seconds."


Fix for Windows 7 & wmic: Invalid XSL format (or) file name

In Windows 7, there is a bug with wmic and the /format switch. When using the /format switch, you will get the error “Invalid XSL format (or) file name.”

1. Example:

C:\Tmp>wmic /output:C:\tmp\procinfo.html CPU get Description,
DeviceID, Manufacturer, MaxClockSpeed, Name, Status, SystemName /format:hform.xsl
Invalid XSL format (or) file name.

2. Cause:

Windows looks for the XSL stylesheets but cannot find them, which produces the error above.

3. Resolution:

Copy *.xsl from x:\Windows\system32\wbem\en-US\ to x:\Windows\system32 – this can be done quicky from command prompt:

copy /y %WINDIR%\system32\wbem\en-US\*.xsl %WINDIR%\system32\

If you run your original wmic command (example in Section 1), there will be no errors and wmic will export data in the format required.

Random Posts Recent Comments

  • Tony Says:

    Thanks it works! Just close the cmd windows and open a new one...

  • greenhart Says:

    I found another way around it. For the /format switch I used: /format:"%WINDIR%\system32\wbem\en-...

  • Jari Aalto Says:

    To determine OS, you can also use command lsb_release(1). See the options how to extract only part o...

  • shadovice Says:

    thanks! it worked like a charm, although there is still minor typo remained: rpm -Uvh http://downlo...

  • Joh Says:

    Great, thank you. Also works with the new version and Centos 6.3 without test repo, just install ...

  • sierprinsky Says:

    Muchas gracias por tu aporte :)...

  • kilby Says:

    The listed solution worked fine for me under Win7 64bit Though I had to run the copy as Asministr...

  • Viper5112 Says:

    The files are already in the C:\Windows\SysWOW64\wbem\en-US and they need to be in the system32 fold...

  • slowmOoh Says:


  • Jørgen Says:

    @Jordan, I had the same problem also on Windows 7 64 bits. It worked for my user account and Admini...

Tag Cloud

backup mail backup mail server backup mailserver backup mx cd burner control multiple computers with one keyboard and mouse control panel DAG disk benchmark disk performance test DNS DNS check enable dag repo free cd burner free DNS check hdd benchmark http proxy install keyboard over network kloxo kloxo 64-bit kvm lxadmin lxadmin-master lxlabs mouse over network mtr ping plotter proxy proxy hide IP qmail repo RPM rpmforge share keyboard and mouse over network share keyboard over network share mouse and keyboard share mouse over network software kvm squid squid hide IP squid proxy trace traceroute tracert