Hi Everyone..
I have a really simple command line program I wrote that I want to run without the need for a Command Prompt/PowerShell window to be left open. Basically, the only place I should find it is in the Processes tab in Task Manager. How can I do this?
As long as you wrote this with a compiled language, you can write your program to run as a Windows Service, rather than a shell.
You can find more information
on the Microsoft MSDN.
You could use AHK to make the window invisible...
These are the code that are use for make a program run in the background (invisible) in Windows.
Code:
if ($args.count -ne 1) {write-host "Requires 1 Argument, exiting...";sleep 2; break}
$a = (get-item -ea silentlycontinue $args[0]).fullname
if ($a -eq $null) {write-host "$($args[0]) is not a valid location, exiting...";sleep 2;break}
# Specifies a set of values that are used when you start a process.
$si = new-object System.Diagnostics.ProcessStartInfo
$si.fileName = "powershell.exe"
$si.Arguments= "-nologo -command `"$($a)`""
$si.WorkingDirectory = $pwd
# this will launch the process in the background (hidden)
$si.windowStyle = [System.Diagnostics.ProcessWindowStyle]::Hidden
# run process under alternate credentials
# $si.UserName="username"
# $si.Password="Password"
# start the process
$process = New-Object System.Diagnostics.Process
$process.startInfo=$si
# this is also valid
# $process = [System.Diagnostics.Process]::Start($si)
# close notepad and watch the output
#if($process.start()) { $process.waitForExit(); "existed"}
$process.start()