Jump to content

checking prior to installing a file


Recommended Posts

I have some code that I want to run an installer for only the first time the code is run.

Essentially, I need a script to run vcredist_x64 on my machine only if it hasnt been installed, and then execute the rest of the program.

I know that in Programs and Features there is a Microsoft Visual C++ 2010 x64 Redistributable 10.0.30319 after installing vcredist_x64, but I was wondering how I would check to see if it's there.

What I did was write some c++ code on VS 2010 that wont run on a computer unless the redistributable is on the machine. So I want the script to first check and see if the redist is installed. if not, install it. then run my application

Is there any way to do this?

Also, seperate subject, how do I use the "WorkingDir" section of the run command?

I would like to call the run command on the application in it's own directory, and not in the script EXEs directory. thanks

Link to comment
Share on other sites

  • Moderators

Kevinsyel,

If you want to know if a file exists, then the aptly named FileExists will tell you. :blink: Depending on the returned value, you can use some form of conditional structure (If, Select, Switch) to install or not.

As for "WorkingDir", just set it to the path of the application.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

would "FileExists" work when attempting to search ControlPanel\All Control Panel Items\Programs and Features ? because I have no idea where it saves the information to.

On the other hand, I've tried many different ways to get workingDir to work

run("PowerTestGUI.exe", "pwrtest\64-bit")

run("PowerTestGUI.exe", "pwrtest\64-bit\")

run("PowerTestGUI.exe", @WorkingDir & "pwrtest\64-bit")

run("PowerTestGUI.exe", @WorkingDir & "\pwrtest\64-bit")

going to try run("PowerTestGUI.exe", "pwrtest\64-bit\PowerTestGUI.exe") now, but it never works with the workingDir

Link to comment
Share on other sites

I attempted to change from Multi-Threaded DLL to Multi-Threaded (command line changed from /MD to /MT)

However, when I rebuild the code, i get an error: Command Line Error D8016: '/clr:pure' and '/MT' command-line options are incompatible.

The code was written using a windows forms application project solution. Could that be why it requires the installation?

Edit: When removing /clr:pure from the command line arguments, the windows-provided code no longer works. it seems that CLR:pure is used to compile some of the code that is microsoft syntax and not part of standard C code

Edited by Kevinsyel
Link to comment
Share on other sites

Why are you using C++/CLI? /clr indicates you are using the .Net framework. C++/CLI is a mess and you should have either written the application in C# or not use WinForms.

To respond to the original question, you can check to see if it is installed in the registry at "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{6A86554B-8928-30E4-A53C-D7337689134D}"

Well this is the x86 version, but you can check your own registry for the correct GUID. Scroll through "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" in regedit and look in each of the GUID keys until you find a display name that says "Microsoft Visual C++ 2010 x64 Redistributable 10.0.30319". That GUID will be the same on every computer. Once you know which it is, you can just check to see whether the key exists or not. If it does, it's installed.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...