User not logged in - login - register
Home Calendar Books School Tool Photo Gallery Message Boards Users Statistics Advertise Site Info
go to bottom | |
 Message Boards » » windows open/focus window from bat script Page [1]  
rynop
All American
829 Posts
user info
edit post

I'm looking to open a folder that is on the desktop from a bat script. If the folder is already open, I want the bat script to give it focus.

I know how to open a folder from a bat script (explorer or start), but I cannot figure out how to simply give the folder window focus if it is already up. If i create a folder 'test' on desktop and open it, then from a command line, i cd to the folders directory, then run 'start .' it will open a new window. I simply want to give it focus.

Anyone know how this can be done?

3/19/2008 3:12:12 PM

Shaggy
All American
17820 Posts
user info
edit post

start /B explorer "c:\Documents and Settings\username\Desktop\test"

worked for me. It opens it if is not open and uses the existing window if it is.

3/19/2008 3:22:06 PM

rynop
All American
829 Posts
user info
edit post

^ that does not work for me.

1) double click the folder named test on your desktop to open it
2) start /B explorer "c:\Documents and Settings\username\Desktop\test"

will open a new window. Does it behave differently for you?

If I open the folder 'test' via start /B explorer, and then run the command again it gives it focus. problem occurst when you doubleclick 'test' folder on desktop first.

[Edited on March 19, 2008 at 3:28 PM. Reason : first]

3/19/2008 3:28:24 PM

Shaggy
All American
17820 Posts
user info
edit post

^ i didn't try double clicking the folder first. It does the same thing for me.

bummer.

3/19/2008 3:40:21 PM

rynop
All American
829 Posts
user info
edit post

anyone? gotta be some windows guru on here that knows how to do this.

I really wanna do this from a .bat, but could be convinced to do it in c# or something if there is a way.

3/21/2008 9:41:39 AM

afripino
All American
11350 Posts
user info
edit post

nm. i might whip up a program for ya.

[Edited on March 21, 2008 at 11:14 AM. Reason : ]

3/21/2008 11:10:42 AM

 Message Boards » Tech Talk » windows open/focus window from bat script Page [1]  
go to top | |
Admin Options : move topic | lock topic

© 2024 by The Wolf Web - All Rights Reserved.
The material located at this site is not endorsed, sponsored or provided by or on behalf of North Carolina State University.
Powered by CrazyWeb v2.38 - our disclaimer.