WMIC scripts using command line (install msi package, Environment Variable)

  • MSI package un-install script
wmic PRODUCT where "name='Microsoft .NET Framework 1.1' and Version='1.1.4322'" call Uninstall
  • MSI package re-install script
wmic PRODUCT where "name='Microsoft .NET Framework 1.1' and Version='1.1.4322'" call Reinstall
  • Set Computer System Time
wmic os where(primary=1) call setdatetime 20070731144642.555555 480

  • Example for Use a batch file to create System Environment Variable 
@ECHO OFF
REM Command line need to use Administrator authority
REM set system Environment variable, "C:\"
REM e.g.
wmic ENVIRONMENT where "name='path' and username='<system>'" set VariableValue="%path%;C:\"
pause
  • Create a new environment variable, Name as "home" Value as "%HOMEDRIVE%%HOMEPATH%"
wmic ENVIRONMENT create name="home",username="<system>",VariableValue="%HOMEDRIVE%%HOMEPATH%"

Comments

Popular posts from this blog

Use Devcon to detect Device (by Hardware IDs)