public static File findProgramFile(String dir, String basename) {
        Vector<File> paths = new Vector<File>();

        if(System.getenv("ProgramFiles") != null) {
            paths.add( new File(System.getenv("ProgramFiles")) );

        }
        if(System.getenv("ProgramFiles(x86)") != null) {
            paths.add( new File(System.getenv("ProgramFiles(x86)")) );
        }

        File[] bases = vectorToFileArray(paths);

        for(int i = 0; i < bases.length; i++) {
            File base = bases[i];
            File pdir = new File(base, dir);
            File exe = new File(pdir, basename + ".exe");
            File bat = new File(pdir, basename + ".bat");
            File cmd = new File(pdir, basename + ".cmd");

            if(exe.exists())
                return exe;
            if(bat.exists())
                return bat;
            if(cmd.exists())
                return cmd;
        }

        return null;
    }