tags:

views:

1085

answers:

3

I am writing a batch script intended for handling some tasks in my (and a few colleagues) windows startup. The main thing that needs to happen is the killing of a few processes that do to this being a large corporate environment are started as default. They interfere with our work so we have to kill them... I know it's stupid but thats beside the point. This is can not be changed and we have to make due.

I thought about adding some more useful functionality to the script, like starting up certain programs and so on. This all works decently well but the problem i have is that the OUClient won't start minimized. It doesn't open a window (so it is minimized to some extent) but it still appears in the alt-tab list, witch it doesn't when i minimize or close it manually. This is the script:

@echo off
C:
cd "C:\Program Files\SysInternals\"

pskill flxps12.exe
pskill flxps17.exe

start /minimized "" "C:\Program Files\Osiris Data\OUClient\OUClient.exe"
start "Outlook" "C:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE"
start "Explorer" "C:\Program Files\Internet Explorer\iexplore.exe"

cls
@exit

So the question is: How can I make the OUClient minimize, or even better close to the system tray (like if you clicked the red x in the upper right) after it is started.

We are running this on Windows XP SP2.

EDIT: Everything works fine except the /minimize on OUClient.

+1  A: 

The minimized switch has a forward slash, not a backslash.

I don't know if OUClient will respect that, but it should.

Charlie Somerville
Yes that was a typo... corrected it now :)
Sakkle
A: 

Have you had a look at the TASKKILL command? A basic example would be

TASKKILL /IM /F iexplore.exe

(yes, who wouldn't want to kill iexplore? ;-))

Best.

loathsome
He wants the program still running, so killing it shouldn't be an option. The window just reacts to trying to close or minimize it; killing the process sidesteps all that.
Joey
But he wants to kill flxps17.exe and flxps12.exe
Charlie Somerville
Ah, right, overlooked that. But that wasn't his question. And pskill works fine, even though taskkill should be available too on a more recent Windows. Still, if you're not answering the question this should better be a comment.
Joey
sorry for the confusion... The pskill part works fine. Its the OUClinet that is the problem
Sakkle
+1  A: 

There is no way to do this from batch files directly, but you can write a little helper program which finds a window and then uses ShowWindow to minimize it. Unfortunately this doesn't seem to be easily available from VBScript which would have made this a little easier.

Joey
Hm... this is what I was afraid of. I'll take a look at the ShowWindow function. Thanks
Sakkle