![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| | |||||||
| |
| 11-03-2008 | #1 (permalink) |
| | Possible to run a Powershell script with no taskbar window? I have a script that needs to run 24/7, but I'd rather not have the additional taskbar button, it gets in the way, so how can I run without it? It's for personal use, so it'd be fine if I had to open task manager to kill the script... Also is it possible to have a script check if it is already running? It has a unique title, so maybe it can scan all program title's somehow? I know these are advanced topics, so thanks for any help. |
| My System Specs |
| 11-04-2008 | #2 (permalink) |
| | Re: Possible to run a Powershell script with no taskbar window? On 4 Lis, 01:52, "James R. Gentile" <n...@xxxxxx> wrote: Quote: > I have a script that needs to run 24/7, but I'd rather not have the > additional taskbar button, it gets in the way, so how can I run without it? > It's for personal use, so it'd be fine if I had to open task manager to kill > the script... Also is it possible to have a script check if it is already > running? *It has a unique title, so maybe it can scan all program title's > somehow? I know these are advanced topics, so thanks for any help. show a winform gui, but with main PowerShell window invisible. The only solution for me was to go and create an executable for that purpose. More at http://www.leporelo.eu/blog.aspx?id=...-in-powershell |
| My System Specs |
| 11-04-2008 | #3 (permalink) |
| | Re: Possible to run a Powershell script with no taskbar window? On Nov 3, 6:52*pm, "James R. Gentile" <n...@xxxxxx> wrote: Quote: > I have a script that needs to run 24/7, but I'd rather not have the > additional taskbar button, it gets in the way, so how can I run without it? > It's for personal use, so it'd be fine if I had to open task manager to kill > the script... Also is it possible to have a script check if it is already > running? *It has a unique title, so maybe it can scan all program title's > somehow? I know these are advanced topics, so thanks for any help. will be totally invisible. Unfortunately, because it is invisible, it has no window title. So there is no good way to tell if it is running besides perhaps to ask the scheduler. I.E. PS 1> schtasks TaskName Next Run Time Status ==================================== ======================== =============== File Watcher At system start up Running PFW_Monitor 7:00:00 AM, 11/4/2008 PS 2> |
| My System Specs |
| 11-09-2008 | #4 (permalink) |
| | Re: Possible to run a Powershell script with no taskbar window? Test this. Require : http://www.leeholmes.com/blog/GetThe...Parameters.asp Code: function ShowWindowAsync([IntPtr] $hWnd, [Int32] $nCmdShow)
{
$parameterTypes = [IntPtr], [Int32]
$parameters = $hWnd, $nCmdShow
Invoke-Win32 "user32.dll" ([Boolean]) "ShowWindowAsync" $parameterTypes $parameters
}
function Show-PowerShell() {
$null = ShowWindowAsync $myWindowHandle 1
}
function Hide-PowerShell() {
$null = ShowWindowAsync $myWindowHandle 0
}
function Minimize-PowerShell() {
$null = ShowWindowAsync $myWindowHandle 2
}
# Values for $nCmdShow
# SW_HIDE = 0;
# SW_SHOWNORMAL = 1;
# SW_NORMAL = 1;
# SW_SHOWMINIMIZED = 2;
# SW_SHOWMAXIMIZED = 3;
# SW_MAXIMIZE = 3;
# SW_SHOWNOACTIVATE = 4;
# SW_SHOW = 5;
# SW_MINIMIZE = 6;
# SW_SHOWMINNOACTIVE = 7;
# SW_SHOWNA = 8;
# SW_RESTORE = 9;
# SW_SHOWDEFAULT = 10;
# SW_MAX = 10 Code: #must be saved before the call $myWindowHandle = (Get-Process -Id $pid).MainWindowHandle start-transcript Hide-PowerShell # (Get-Process -Id $pid).MainWindowHandle -eq 0 sleep 2 Show-PowerShell; Code: $myWindowHandle = (Get-Process -Id $pid).MainWindowHandle # PowerShell-Scripting.com - PowerShell Form Converter V0.9 ... $Form1.Add_Shown({Hide-PowerShell;$Form1.Activate()}) $Form1.ShowDialog() $Form1.Dispose() Show-PowerShell; |
| My System Specs |
| Thread Tools | |
| |
| Similar topics to: Possible to run a Powershell script with no taskbar window? | ||||
| Thread | Forum | |||
| Re: Don't show powershell in taskbar | PowerShell | |||
| RE: Don't show powershell in taskbar | PowerShell | |||
| Converting a BAT script into a PowerShell Script | PowerShell | |||
| when run powershell script as windows service ,powershell fail | PowerShell | |||
| Script pauses when you click in the powershell text window | PowerShell | |||