Share this page

# Launch AUT code samples (.NET SDK)

The following code samples show how to launch a desktop application using different parameter combinations. To used this capability, you must create an application allowlist file. For details, see Run desktop applications from the UFT Developer SDK.

Launch the calc application using its full path and then close the application.

    [Test]
    public void TestAutFullPath()
    {
    	IAut calc = Desktop.LaunchAut("C:\\Windows\\System32\\calc.exe");
    	//your test code goes here
    	calc.Close();
    }

Launch the calc application using only its name.

    [Test]
    public void TestAutShortcut()
    {
    	IAut calc = Desktop.LaunchAut("calc");
    	//your test code goes here
    	calc.Close();
    }

Launch notepad using its name and the file that you want to open.

    [Test]
    public void TestAutWithArgument()
    {
    	IAut notepad = Desktop.LaunchAut("notepad", "C:\\Temp\\1.txt");
    	//your test code goes here
    	notepad.Close();
    }

Launch notepad using two arguments: the file that you want to open and a notepad argument for opening the file in unicode, and the directory where the file resides.

    [Test]
    public void TestAutWithArgumentsAndWorkingDirectory()
    {
    	IAut notepad = Desktop.LaunchAut("notepad", new string[] { "/w", "unicode.txt" }, "C:\\Temp");
    	//your test code goes here
    	notepad.Close();
    }

Describe the environment you need and launch the calc application on a grid node using its name.

                    [TestMethod]
    public void TestAutShortcutOnGrid()
    {
    	// Aquire an environment
           var environmentDescription = new EnvironmentDescription();
    	environmentDescription.Set("ostype", "Windows");
    	var environment = EnvironmentFactory.Get(environmentDescription);

    	var calc = environment.LaunchAut("calc");

    	// Your test code goes here

    	calc.Close();
    }

Tips to improve your search results... UFT Developer .NET SDK Reference Version 15.0-15.0.2 UFT Developer SDK Reference All View Local Help Center View Online Help Center back Go back in browser history forward Go forward in browser history Remove search highlights next topic Go to next topic previous topic Go to previous topic Print the current topic Version: