0

Run notepad or any other windows application with Release Definition on build server using powershell or batch scripts: I tried all the commands known to me:

& ′notepad.exe′
Invoke-Expression -Command ′notepad.exe′
Start-Process -FilePath ′notepad.exe′
[System.Diagnostics.Process]::Start(′notepad.exe′)
([wmiclass]″Win32_Process″).Create(′notepad.exe′)
Invoke-WmiMethod -Class Win32_Process -Name Create -ArgumentList ″notepad.exe″
Invoke-Command -ScriptBlock {& notepad.exe′}
cmd /c ″notepad.exe″

When running on the server itself everything works(start notepad or any onther win app) but When i tried running by TFS Release Definition : Command end successful but on build server - nothing happens.

Any Ideas!!!

  • How are you making the determination that nothing happens? If you're logged into the build server but notepad is opened by the user the build/release process executes as, you're not going to see it. – Paul Abbott Aug 29 '18 at 20:25
  • I check in my Build Server an i want see Notepad is open ... in fact, nothing happens there, just in Task Manager i can see in Background processes something running ... But I do not want to see in the processes, I want to start notepad remotely through TFS Release Defenitions! – Dimitri Goldshtein Aug 29 '18 at 20:40
  • Notepad is a bad choice as it's a GUI application. What is your **actual** goal? – Daniel Mann Aug 30 '18 at 04:02
  • actual Goal it’s run GUI applications it was for this purpose that the Notepad (for example) – Dimitri Goldshtein Aug 30 '18 at 09:51

1 Answers1

0

If your agent runs in interactive mode and all the other settings are configured correctly, then the answer is that the command works. But the issue is that all the launched process will be closed as soon as the build/release is finished.So you didn't see the launched app when check it. To verify this, add a powershell script task with following command:

Start-Process -FilePath 'C:\Windows\System32\notepad.exe' -wait

Run the release and check on server, you should see notepad is opened. However, this command will cause the release never finish until you close the notepad.

Eddie Chen - MSFT
  • 29,708
  • 2
  • 46
  • 60