How do I programmatically find Program Files directory?

Do I need to use the Windows Registry? If so, where is it in the registry?
I'm ultimately trying to find the Wordpad.exe file. I've been able to find where it's location is stored in the registry, but the location listed is relative to the Program Files directory. Thus, I must now find the Program Files directory, too.
Thanks in advance,
Derek

Attached is a VI WINDOWS-FIND-ABSOLUTE-APPLICATION-PATH.VI
Given an application name in the regsitry such as WORDPAD.EXE this VI is intended to read all the necessary information from a Windows machine registry and return an absolute path.
The VI specifically checks first to ensure that it is operating on a Windows platform before proceeding to read any registry keys. I don't work with other platforms a great deal, perhasps someone would care to 'fill in the blanks'. Entrys in the registry for an application registration are either absolute or relative (I believe they should normally be relative to the %ProgramFiles% registry entry to allow system restoration to an alternative location).
I did this because I wonderd why the question had been posed. There are a number of especilly interesting things happen with respect to WORD and the way associated files are dealt with. However I imagine a scenario like this. I am running a nice fat VI with lots of demands on system resources and I want to open up a viewer application for an RTF file I have generated. I don't want WORD to open the files as its a great FAT application and has currently taken over the association for RTF files (despite it not being the registered handler in the registry - that's another story). Thus I want a lightweight application to do the work. Hence this VI.
If this does the job please let us all know.Message Edited by Conseils on 04-16-2005 10:15 PM
Attachments:
Windows-Find-Absolute-Application-Path.vi ‏88 KB

Similar Messages

  • How to write code for save file directory?

    how to write code for save file directory?

    how to find usa timezone code using java swing?
    i have some code help me
    public class ItsInitializer {
    private static boolean s_initialized = false;
    private ItsInitializer() {
    public static synchronized void initialize() {
    if (!s_initialized) {
    // Modifies default time zone, disables Daylight Saving Time.
    TimeZone l_defaultTimeZone = TimeZone.getDefault();
    int l_rawOffset = l_defaultTimeZone.getRawOffset();
    String l_id = l_defaultTimeZone.getID();
    SimpleTimeZone l_simpleTimeZone = new SimpleTimeZone(l_rawOffset,
    l_id,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0);
    TimeZone.setDefault(l_simpleTimeZone);
    s_initialized = true;
    2.
    long timeMillis = ...;
    long time = timeMillis / 1000;
    String seconds = Integer.toString((int)(time % 60));
    String minutes = Integer.toString((int)((time % 3600) / 60));
    String hours = Integer.toString((int)(time / 3600));
    for (int i = 0; i < 2; i++) {
         if (seconds.length() < 2) {
              seconds = "0" + seconds;
         if (minutes.length() < 2) {
              minutes = "0" + minutes;
         if (hours.length() < 2) {
              hours = "0" + hours;
    3.
    import java.text.SimpleDateFormat;
    import java.util.Date;
    public class Convert {
    public String getDateTime(String pattern){
    SimpleDateFormat sdf = new SimpleDateFormat(pattern);
    return sdf.format(new Date());
    * @param args
    public static void main(String[] args) {
    Convert con = new Convert();
    System.out.println(con.getDateTime("hh:mm:ss"));
    5.import java.text.SimpleDateFormat;
    import java.util.Date;
    public class Convert {
    public String getDateTime(String pattern){
    SimpleDateFormat sdf = new SimpleDateFormat(pattern);
    return sdf.format(new Date());
    * @param args
    public static void main(String[] args) {
    Convert con = new Convert();
    System.out.println(con.getDateTime("hh:mm:ss"));
    [ November 23, 2005: Mess
    private Locale locale = Locale.US;
    private static final String[] tzStrings = {
    "America/New_York",
    "America/Chicago",
    "America/Denver",
    "America/Los_Angeles",
    Date now = new Date();
    for ( TimeZone z : zones) {
    DateFormat df = new SimpleDateFormat("K:mm a,z", locale);
    df.setTimeZone(z);
    String result = df.format(now);
    System.out.println(result);
    String date="05/19/2008 04:30 AM (EST)";
                   SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy hh:mm aaa (z)");
                   TimeZone.setDefault(TimeZone.getTimeZone("PST"));
                   long millis = sdf.parse(date).getTime();
                   sdf.setTimeZone(TimeZone.getDefault());
                   System.out.println(sdf.format(new Date(millis)));
    [ November 23, 2005: Mes                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How can I open the windows file directory in "WHEN-BUTTON-PRESSED" trigger

    Dear All,
    How can I open the windows file directory in “WHEN-BUTTON-PRESSED” trigger?

    Blessan Joseph,
    The solution is dependent on your Forms version and if your applications is traditional Client/Server (CS) (Forms 6i and lower) or web deployed (Forms 6i and higher). For CS, you would use the Get_File_Name() built-in as Faa demonstrated. For Web, you will need to use the WebUtil library function Client_Get_File_Name() as Sarah (OGIR) demonstrated. Both of these functions will return the full path to a file. Note: WebUtil is an external library so it requires you to perform some configuration on your developer client as well as on the Application Server. WebUtil is included with Forms 9i and higher, but you must download it for Forms 6i.
    My requirement is user should able to select windows directory for the output.Do you really need to allow the user to write to a file in the Windows directory? This is very dangerous and you should not allow users or programs to write to the Windows directory. Users should only be able to write files to "User" directories (\My Documents\<Directory name>).
    Craig B-)
    If someone's response is helpful or correct, please mark it accordingly.

  • Cant find program files i have game stored t

    my old computer  i was able to access my program files, which is where all my games i owned were stored. i am unable to find program files on my new puter which is a h.p. i hate this new puter i can not find amything and can not figure how to find it

    Hi,
    No, not HP, it's Windows and I believe your new computer uses Windows 8. Welcome to the new world. Now my questions: have you installed games on new machine yet ?
    Regards.
    BH
    **Click the KUDOS thumb up on the left to say 'Thanks'**
    Make it easier for other people to find solutions by marking a Reply 'Accept as Solution' if it solves your problem.

  • When I download a page a message says cannot find zip file directory

    When I try to download a page a message appears after the download time saying in part that "cannot find zip file directory". This message appears on all downloads I attemp.

    Here are typical layouts for the iTunes folders:
    If you have upgraded from version 8 (or earlier) to iTunes 9 (or later) at some point, then your media folder (everything inside the red outline) may still be called iTunes Music instead of iTunes Media. The extra Music folder inside the media folder is used if you have allowed iTunes to Upgrade to iTunes Media Organization (iTunes 9) or used File > Library > Organize Library > Reorganize files in the folder "<Media Folder>" (iTunes 10). Depending on your choices for Keep iTunes Media folder organized and Copy files to iTunes Media folder when adding to library plus a little bug in which one build changed the name of the file storing the choice of layout it is quite easy for some of your files to be organized according to one layout and some the other.
    It is possible that in the upgrade to Lion iTunes has been installed with the current default options while your library is based on an older structure. Use Get Info. on a missing track, click cancel when asked to locate it and look at the path given on the summary tab. Now look for the actual file with Finder. Post both paths back here and we can try to make sense of the problem.
    tt2

  • Antivirus has quarantined files from firefox program files directory as malware

    These 3 files have been quarantined as heuristic viruses or Trojans:
    libegl.dll
    nssdbm3.dll
    webapprt-stub.exe
    All 3 files are in the program files directory for firefox. After these files were quarantined and I tried to start FF I got error:
    Could not initialize the application's security component. The most likely cause is problems with files in your application's file directory. Please check that this directory has no read/write restrictions and your hard disk is not full or close to full. It is recommended that you exit the application and fix this problem. If you continue to use this session, you might see incorrect application behavior when accessing security features.
    Once I click OK it opens FF but it won't open the homepage. I want to be very sure these are actually FF program files and not some virus attempting to wreak havoc on my laptop. thanks.
    unfortunately, I can't add any troubleshooting information as i'm in IE writing this up since I can't open FF.

    This might have been false positives.
    See also:
    *https://support.mozilla.org/kb/Could+not+initialize+the+browser+security+component
    Try to delete the cert8.db file and possibly the secmod.db file as well.
    *http://kb.mozillazine.org/Profile_folder_-_Firefox
    Do a clean reinstall and delete the Firefox program folder before (re)installing a fresh copy of the current Firefox release.
    Download a fresh Firefox copy and save the file to the desktop.
    *Firefox 24: http://www.mozilla.org/en-US/firefox/all.html
    Uninstall your current Firefox version, if possible, to cleanup the Windows registry and settings in security software.
    *Do NOT remove personal data when you uninstall your current Firefox version, because all profile folders will be removed and you lose personal data like bookmarks and passwords from profiles of other Firefox versions.
    Remove the Firefox program folder before installing that newly downloaded copy of the Firefox installer.
    *(32 bit Windows) "C:\Program Files\Mozilla Firefox\"
    *(64 bit Windows) "C:\Program Files (x86)\Mozilla Firefox\"
    *It is important to delete the Firefox program folder to remove all the files and make sure that there are no problems with files that were leftover after uninstalling.
    *http://kb.mozillazine.org/Uninstalling_Firefox
    Your bookmarks and other personal data are stored in the Firefox profile folder and won't be affected by an uninstall and (re)install, but make sure that "remove personal data" is NOT selected when you uninstall Firefox.
    If you keep having problems then also create a new profile.
    *http://kb.mozillazine.org/Profile_folder_-_Firefox
    *http://kb.mozillazine.org/Profile_backup
    *http://kb.mozillazine.org/Standard_diagnostic_-_Firefox#Clean_reinstall

  • How do I delete C:program files (x86)/common files/apple

    How do I delete C:program files (x86)/common files/apple ?
    There is a prompt which says that the folder or file is in use in another program.
    I am trying to uninstall all Apple progams as suggested by apple support because iTunes won't communicate with my iPod

    Hello RooDogg,
    Thanks for the question. It sounds like there may be a program or service still running that is utilizing this folder. You can double check by making sure the 6 components are uninstalled from the Control Panel:
    Removing and reinstalling iTunes, QuickTime, and other software components for Windows Vista or Windows 7
    http://support.apple.com/kb/HT1923
    Use the Control Panel to uninstall iTunes and related software components in the following order and then restart your computer:
    1. iTunes
    2. QuickTime
    3. Apple Software Update
    4. Apple Mobile Device Support
    5. Bonjour
    6. Apple Application Support (iTunes 9 or later)
    If the above are already uninstalled, restart your computer and then confirm that the C:\Program Files\Common Files\Apple\ can be removed. If it cannot, follow the additional steps at the bottom of the article (referring to iPodService.exe).
    Thanks,
    Matt M.

  • How do I find program files on my pro?

    I need to access the program file for my steam account because it is not finding the servers.  Steam suggest that I set my own launch options, but I cannot find where the program file is for steam.

    I need to find how to execute the file differently.  These are the instructions on steam, but they are for pc
    Set Steam Launch Options
    Navigate to your Steam installation (by default this is located at C:\Program Files\Steam)
    Right-click on Steam.exe (this file is listed as an application and features the black and white Steam logo) and select Create Shortcut
    Right-click on the new shortcut and go to Properties
    Select the Shortcut tab
    In the Target: field add the launch options which you would like to use after the Steam.exe location (make sure to separate all launch options with a space - For example, " -launchoption1 -launchoption2")
    Click Apply and then OK to close the Properties window

  • How do I move some program files and redirect my user files from ssd C to drive E?

    Brand new HP Phoenix  h9-1183, Windows 7 64 bit SSD only 99.2 GB, data drive E: 2 TB.
    When tried to transfer files from old HP desktop to new Phoenix, I got the message that there was not enough space. When I took a closer look, I was surprised that only 99.0GB was assigned to the OS. I have been trying to figure out how to remove some of the programs that came with the computer (i.e. DVD Maker, Windows mail, Cyberlink Power DVd, Power2go etc.) from the C drive onto the E drive where there is more space. Also if I could move my library (documents, pictures, music, vide etc.) to E  drive that would give the OS drive more space for updates etc. I have been searching for the how to, but have discovered that the program files and user files which contain the library etc. should not be moved according to Microsoft and if they are they won't cover any service. Tried to contact them with my problem (and it seems this will become a bigger problem as more and more of the newer computers containing ssds are going this way with little space in the C: SSD) and I got the message to contact my computer manufacturer. Tried seeing on the HP help and support if there is a solution for this and saw nothing. So here I am with a new computer and I've spent a couple of weeks now trying to set things up and searching for a way to allow more hard drive space. I found this site ( http://www.youtube.com/watch?v=kKTNmoq2zXI&feature=fvwrel) on how to move user files from C onto new drive, but it only works for 1 folder (I moved my video folder and then when I tried to move my pictures, it got messed up and I had to do a restore. There must be a simple way to fix this; otherwise this computer is useless. Thanks for any help or suggestions!!
    Charlotte

    Hi,
    That's right, this is the installation process:
    C. Install and activate Norton Internet Security
    You can install and activate Norton from a CD or a downloaded file:If you do not want to join Norton Community Watch, uncheck the option. By default, this option is checked.
    Insert the CD into your computer's CD-ROM drive (if you are installing from a download, double-click the file you downloaded and proceed to step 2).
    Place a check in the box next to Norton Security Software, and click Next.
    When the installation is complete, find and open the Norton Security Software folder on your desktop.
    Double-click on the Install Norton Internet Security.exe icon to begin the installation.
    Click OK to begin the installation, or click Install Options to change where Norton installs, and then click Browse to locate the new location. ........
    Regards.
    BH
    **Click the KUDOS thumb up on the left to say 'Thanks'**
    Make it easier for other people to find solutions by marking a Reply 'Accept as Solution' if it solves your problem.

  • "Program files" directory problem during Microsoft Office Customization Installer in non-English versions of Windows

    We have a document-level customization solution for Word and are experiencing problems during deployment in an environment running on terminal services. The OS (Windows 2012) is English and Word (2013) is non-English (German). 
    Installation is done into the "Program Files" folder correctly. But when trying to start a word document linked to the specific template. The "Microsoft Office Customization Installer" pops up with the error.
    "There was an error during installation"
    From: file:///C:/Programme/[CompanyName]/[Productname]/[Productname].vsto
    Downloading file:///c:/Programme/[CompanyName]/[Productname]/[Productname].vsto did not succeed.
    Exception: ....
    System.Deployment.Application.DeploymentDonwloadException: Download file:///C:/Programme/[Companyname]/Productname]/[Productname].vsto did not suceed. ---> System.Net.WebException: Could not find a part of the path 'C:\Programme\[Companyname]\[Productname]\[Productname].vsto'.
    ---> System.Net.WebException: ...... ---> System.IO.DirectoyNotFoundException......
    The problem seems to be that the installer is looking for C:\PROGRAMME instead of C:\PROGRAM FILES. C:\PROGAMME is the German localized name of PROGRAM FILES (http://en.wikipedia.org/wiki/Program_Files).
    The installer installs the solution correctly deployed into c:\program files, but when the later a user tries to start it and the Microsoft Office Customization Installer is called, it tries to access the non-existing "c:\programme" folder. This
    doesn't exist, because Windows is English.
    Is there any thing related to deploying solutions on a platform which has different languages (mixing/matching of OS language and Office language?)
    Thank you for your help

    Hello,
    1. First, I would confirm with you whether you dealt with the localization for your document-level add-in?
    2. Did you use this way to define the Create a class that defines the post-deployment action part of Put the document of a solution
    onto the end user's computer (document-level customizations only) and did you get the path with Environment.SpecialFolder enum?
    To handle this, I would recommend you consider using Environment.SpecialFolder to set that property.
    Regards,
    Carl
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How do I make Adobe program files accessible to virus scan?

    Following Jeff's advice, I am reposting my original question in this forum with the screen shots. (I have posted too many questions and have gotten several useful answers. However my main question has gotten only one answer, notably that I should not use any virus protection program on my editing computer. Since right now this is my only computer, I can't follow this advice.)
    The issue: The BitDefender Antivirus program skips all (or most?) Adobe program files because they are password protected.
    My questions:
    1. Should I just leave those program files un-scanned? (Any danger that viruses could get into password protected files?)
    2. Are those files password protected by Adobe? If so is it to avoid changes (deliberately or accidentally) made by the users?
    3. If there is no potential danger to un-protect them, how do I do it?
    Please see two screen shots below.
    Thanks for any help,
    Laci.

    Not possible with Reader. As suggested, look for a better way to transfer your files, or use the trial version of Acrobat to optimize the PDF.

  • I have firefox installed in the program files (x86) directory and nightly installed in the program files directory. When I double click on the nightly icon, firefox starts up. I have gone directly to the program folder with the same results.

    I am running win 7 ultimate 64 w/8g mem
    This happens in the reverse also. Can't open firefox if nightly is open. nightly is 11.0a1 (2011-11-17)
    firefox is 8.0

    Hi Scott,
    Help #1: I don't understan the concept of Step 1, Step2 and Step 3 to do XML Schema, XSD.exe, and XML Schema Collection in the SQL Server 2012!!?? I just have the SQL Server 2012 Management Studio (SSMS2012) in my PC.
    Step1 and Step2 not that related to SQL Server, you can get the XSD from a given XML with an online XSD generator.
    Google search: XSD generator
    Help #2: How can I execute the xsd.exe in my C:\Program Files  (x86)\Microsoft SDKs\Windows\v7.0A\Bin\ folder?
    Please see the link in the #1
    Help #3: I just learned the basic things of creating XML SCHEMA COLLECTIONS in my SSMS2012 directly. Is the MSss2012P348.sql (I created and presented above) right for the task? How can I use clipboard to create the XML Schema Collection in
    my ScottChangDB database?
    See the syntax and example in
    create XML schema collection
    If you have any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • Software Restriction Policy not allowing Program Files directory on 64-bit machines

    I've created a new software restriction policy, my default security level is set to "Disallowed", I have the standard built-in allowed locations:
    %HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRoot%
    %HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ProgramFilesDir%
    and I added another exemption for the C:\Program Files (x86) directory:
    %HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ProgramFilesDir (x86)%
    However, on my 64-bit machines, there are still programs being blocked in C:\Program Files:
    C:\Program Files\Microsoft Office 15\ClientX64\OfficeC2RClient.exe
    C:\Program Files\Microsoft Office 15\Root\Office15\MsoSync.exe
    These same programs are not being blocked on my 32-bit machines, but the same policy is being applied to both and the programs are installed in the same locations on both.
    I checked the registry on one of the 64-bit machines, and the default registry key exemption specified above:
    %HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ProgramFilesDir%
    does exist on the 64-bit machine and it is set to C:\Program Files, exactly like the 32-bit machines. So why are programs still being blocked here?
    Shaun

    Hi Shaun,
    >>on my 64-bit machines, there are still programs being blocked in C:\Program Files:
    Before going further, are all the applications under the path not able to run or just some ones? Besides, when we run the applications mentioned above, did it tip that it's blocked by group policy? Here, we can run command
    gpresult/h gpreport.html with administrative privileges to collect group policy result report to check if this is caused by some other GPOs.
    Best regards,
    Frank Shen
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected]

  • How to do I find the files I restored from my USB

    Grandkids playing online video games and the whole pc crashed.  Have it up and running and reinstalled programs.  Cannot find the files/pictures/folders/ documents I restored that were backed up on USB

    @tallylassy
    Lok in the backup folder for a file with .exe extension.If you have that it should start the transfer of files to your machin_C:\System Recovery. You can then move them wherever you want them.
    @NewbieL
    Your usb flash drive is evidently not recognized as a useable device for Backup. Do you have it plugged in during the scheduling? Is it plugged directly into usb port, not a multi-port hub? You may have to invest in an external usb hdd.
    ******Clicking the Thumbs-Up button is a way to say -Thanks!.******
    **Click Accept as Solution on a Reply that solves your issue to help others**

  • How do I target my Program Files (x86) folder to uninstall applications?

    I've subscribed to Cloud 6, but I first want to uninstall my CS5 products before installing the Cloud apps. I have a 64-bit system and Win 7. There is a Program Files folder and a Program Files (x86) folder where my CS5 app reside. However, I can't seem to get my Win 7 Uninstaller to target the (x86) folder, so I'm stuck. Any advice on how to properly uninstall the programs from that location?

    Have you followed these steps?
    http://helpx.adobe.com/creative-suite/kb/uninstall-creative-suite-cs5-cs5.html#main_Uninst all_Creative_Suite_5_or_CS5_5__Windows_7__Windows_Vista_
    Should be all you need to do.
    I recommend successfully installing and activating CS6 before you uninstall CS5.

Maybe you are looking for