Kevinsyel Posted July 20, 2010 Share Posted July 20, 2010 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 More sharing options...
Moderators Melba23 Posted July 20, 2010 Moderators Share Posted July 20, 2010 Kevinsyel,If you want to know if a file exists, then the aptly named FileExists will tell you. 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 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Kevinsyel Posted July 20, 2010 Author Share Posted July 20, 2010 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 More sharing options...
Richard Robertson Posted July 20, 2010 Share Posted July 20, 2010 If you go into the project properties, go to C/C++, Code Generation, and change runtime library from Multi-threaded dll to Multi-threaded. This includes the runtime in your executable making it distributable without the extra installed library. Link to comment Share on other sites More sharing options...
Kevinsyel Posted July 20, 2010 Author Share Posted July 20, 2010 (edited) 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 July 20, 2010 by Kevinsyel Link to comment Share on other sites More sharing options...
Richard Robertson Posted July 20, 2010 Share Posted July 20, 2010 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now