Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Server > Scripting > newbie looking for file location

Reply
Thread Tools Display Modes

newbie looking for file location

 
 
TD
Guest
Posts: n/a

 
      11-05-2009
I am trying to write a script that I can launch from a login bat file that
looks for a location of a program. Once the file location is found I want to
take that location and dumps it to a reg key. Here's an example

We want to set a default photo viewer on our network and would like to use
Microsoft Office Picture Manager. I have found that this file can be located
in different locations. On log in I would like the script to check basically
3 locations (c:\program files\Microsoft office\Office11, c:\program
files\Microsoft office\Office12, and c:\program files\Microsoft
office\ART\Office12) and then copy the path that is finds the OIS.exe file
to a key in the registry.

Can someone point me to the easiest cleanest way to do this.


TIA

 
Reply With Quote
 
 
 
 
Pegasus [MVP]
Guest
Posts: n/a

 
      11-05-2009

"TD" <> wrote in message
news:12CC7D9A-7655-476D-B8F5-...
>I am trying to write a script that I can launch from a login bat file that
>looks for a location of a program. Once the file location is found I want
>to take that location and dumps it to a reg key. Here's an example
>
> We want to set a default photo viewer on our network and would like to use
> Microsoft Office Picture Manager. I have found that this file can be
> located in different locations. On log in I would like the script to check
> basically 3 locations (c:\program files\Microsoft office\Office11,
> c:\program files\Microsoft office\Office12, and c:\program files\Microsoft
> office\ART\Office12) and then copy the path that is finds the OIS.exe file
> to a key in the registry.
>
> Can someone point me to the easiest cleanest way to do this.
>
>
> TIA


To see if a file exists, use the oFSO.FileExists method of the File System
Object. You will find the method fully explained (with an example!) in
script56.chm, a help file that you can (and should!) download from the
Microsoft site.

To insert a value into the registry, have a look here:
http://blogs.technet.com/heyscriptin...istry-key.aspx.
To download the whole Scripting Guy file (highly recommended!), look here:
http://www.microsoft.com/downloads/d...displaylang=en.

And if you want a very easy method to do the job, use a batch file. It has a
"if exist FileName" command and the tool reg.exe lets you create a new
registry key.


 
Reply With Quote
 
jford
Guest
Posts: n/a

 
      11-09-2009

It works...

<batch>
@echo off

set loc1="C:\Program Files\Microsoft Office\Office11\OIS.exe"
set loc2="C:\Program Files\Microsoft Office\Office12\OIS.exe"
set loc3="C:\program files\Microsoft Office\ART\Office12\OIS.exe"

if exist %loc1% (
call :regadd %loc1%
)
if exist %loc2% (
call :regadd %loc2%
)
if exist %loc3% (
call :regadd %loc3%
)
goto end
:regadd
reg add <keyname> /v <valuename> /d %1
:end
</batch>

"TD" wrote:

> I am trying to write a script that I can launch from a login bat file that
> looks for a location of a program. Once the file location is found I want to
> take that location and dumps it to a reg key. Here's an example
>
> We want to set a default photo viewer on our network and would like to use
> Microsoft Office Picture Manager. I have found that this file can be located
> in different locations. On log in I would like the script to check basically
> 3 locations (c:\program files\Microsoft office\Office11, c:\program
> files\Microsoft office\Office12, and c:\program files\Microsoft
> office\ART\Office12) and then copy the path that is finds the OIS.exe file
> to a key in the registry.
>
> Can someone point me to the easiest cleanest way to do this.
>
>
> TIA
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Move \Users folder once for all Peter Meinl Windows Vista Installation 25 03-03-2010 01:37 AM
Reset default location for Documents folder - Vista Mike Windows Vista File Management 6 01-25-2010 09:54 PM
Change Folder name for C:/Users/account_name Gary McCready Windows Vista Administration 11 07-23-2008 12:00 PM
is there some location (c.f. [CommonAppData]) where even limited users can modify/write files? Bob Eaton Windows Vista File Management 15 03-20-2007 07:25 AM
Location setting inconsistent BigBNY Windows Vista File Management 0 10-15-2006 08:04 PM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59