WshShell Class

MSBuild Extension Pack

WshShell Class MSBuild Extension Pack Help 4.0.12.0
Valid TaskActions are:

CreateShortcut (Required: Name, FilePath Optional: Arguments, ShortcutPath, Description, WorkingDirectory, IconLocation)

Remote Execution Support: No

Inheritance Hierarchy

SystemObject  Microsoft.Build.UtilitiesTask
    MSBuild.ExtensionPackBaseTask
      MSBuild.ExtensionPack.ComputerWshShell

Namespace: MSBuild.ExtensionPack.Computer
Assembly: MSBuild.ExtensionPack (in MSBuild.ExtensionPack.dll) Version: 4.0.0.0

The WshShell type exposes the following members.

Constructors

  NameDescription
Public methodWshShell
Top
Properties

  NameDescription
Public propertyArguments
Sets the Arguments for the shortcut
Public propertyDescription
Sets the Description. For CreateShortcut defaults to 'Launch [Name]'
Public propertyFilePath
Sets the FilePath
Public propertyIconLocation
Sets the IconLocation
Public propertyName
Sets the Name
Public propertyShortcutPath
Sets the ShortcutPath. For CreateShortcut defaults defaults to Desktop of the current user
Public propertyWindowStyle
Sets the WindowStyle.

1 - Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position.

3 - Activates the window and displays it as a maximized window.

7 - Minimizes the window and activates the next top-level window.

Public propertyWorkingDirectory
Sets the WorkingDirectory
Top
Examples

<Project ToolsVersion="4.0" DefaultTargets="Default" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
        <TPath>$(MSBuildProjectDirectory)\..\MSBuild.ExtensionPack.tasks</TPath>
        <TPath Condition="Exists('$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks')">$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks</TPath>
    </PropertyGroup>
    <Import Project="$(TPath)"/>
    <Target Name="Default">
        <!-- Create a shortcut -->
        <MSBuild.ExtensionPack.Computer.WshShell TaskAction="CreateShortcut" Name="My Calculator.lnk" FilePath="C:\Windows\System32\calc.exe"/>
    </Target>
</Project>
See Also

Reference