How do you register a name for a program in the windows run dialog? - vb.net

How do you register a name for a program in the windows run dialog?
For instance typing in "notepad" and pressing enter runs notpad.exe
"photoshop" in my case runs Photoshop CS3
I'm using vb2005.net

Besides the system path, there's also the App Paths in the registry. Visual Studio, for example, doesn't have its main app (devenv.exe) in the PATH, but you can still launch it from the Run dialog.
Available names are enumerated under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths, with corresponding launch paths as values under each name.
See http://www.tweakxp.com/article36684.aspx for an example of how to add an exe to your App Paths.

This works because those applications have added the directory containing their executable to Window's PATH variable. This variable is used to resolve the locations of any files entered into the run dialog (among other things).
Please see How to set the path in Windows 2000 / Windows XP.

There is no registration, your program .bat, .exe must be within the system path.
If you right-click on "My Computer" ->"Properties"-> "Advanced" then go to the "System Variable". You can edit the "Path" variable to include the location of your executable.

This has nothing to do with "registering" a program. Windows uses the current value of your PATH environment variable, and any executables found in those directories can be executed by simply typing the name into the Windows "Run" box (or command prompt, or anything else that launches executables).
Some programs add their directories to the PATH, others drop an executable (or even a batch file) into a well-known directory that is already part of the PATH, such as the Windows directory.

Add the program's path to your PATH variable.
If you want to do it programmaticly, you can edit (append, not just set) this registry location (in, say, your installer):
HLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\Path

Related

Use CMake build system for Fortran simulation on CodeBlocks [duplicate]

I am using Windows XP. I am trying to add a new library to Dev-C++. For that, I need to install MinGW and then I have been instructed to add the bin directory of MinGW to my system path. But, I don’t know how to do it. Please guide me (step by step) to add this to my system path.
To change the path on Windows XP, follow these instructions, and then add the directory where you install MinGW plus bin. Example: if you install MinGW in C:\ then you have to add C:\mingw\bin to your path
Just for completeness here are the steps shown on the link:
From the desktop, right-click My Computer and click Properties.
In the System Properties window, click on the Advanced tab.
In the Advanced section, click the Environment Variables button.
Finally, in the Environment Variables window, highlight the Path variable in the Systems Variable section and click the Edit button. Add or modify the path lines with the paths you wish the computer to access. Each different directory is separated with a semicolon as shown below.
C:\Program Files;C:\Winnt;C:\Winnt\System32;c:\mingw\bin

How to fix 'VSTest.Console.exe' is not recognized as internal or external command

i am trying to run my MSTest from the command line, and I cannot for the life of me figure out why this isn't working. Yes it works if I manually change the directory to the executable, but I don't want to do that every time.
In the image below, you can see I have set up the environment variable, and yes I have restarted my computer many times.
You need to add it to your PATH variable. In that same dialog edit the Path variable and add the folder to the path. For example, I have enterprise installed, so I used this path:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow
After updating the path you will need to close and restart the cmd window.

I need to change the path and use the newly changed path

We are using a really old Intel math library (nsp.dll and family) and it's location must be specified in the Windows PATH variable. Previously we installed these dll's in the Windows/System32 folder so everything was fine. Now we would like to install these dll's in another folder, the reason is we are migrating to Windows 7 and do not want to place dll's in the System32 folder. I found the SO answer as to how to change the PATH variable (thanks for that) and that does work. After installing I checked the PATH and our folder was NOT added to the PATH, I check the reg key and our folder WAS added. But....it appears that when we register our OCX that uses those dll's, the path is not changed yet. When I rebooted the PATH has our added path.
So, it seems I'm in a catch-22, I need to change the PATH and also use the new PATH during the install. Do I need to require a reboot and some how register that OCX after the reboot? Or is there another way?
After the reboot, running cmd as Administrator allowed me to register the OCX in the new folder. But I would like to have the installer do this automatically.
Thanks.
Make sure that you have the following setting in your script:
[Setup]
ChangesEnvironment=yes
This will allow the PATH change to take effect without a reboot.
However it will only affect new processes started by the shell. If you have an existing cmd window, or you try to start the application at the end of the install without using the shellexec flag, it will still see the old PATH.
And double-however: you cannot legally change the path where a COM DLL or OCX file is installed and registered. These must without exception be installed in the location specified by the vendor. Hence you must continue to install it in {sys} anyway. (At least if you're still using system-wide registration. There is an alternative that does let you move it, if you look up "registration-free COM", but it comes with a lot of caveats and is seldom worth the effort.)
Also note that "because Windows 7" is not a valid reason to move something anyway.

how to use API when there's no binary

Normally when I use an API I download the binary containing the JAR which I then add to the classpath. I want to try Curve API but there's no binary (and hence no JARs in the download). I'm using Eclipse and I have read that you can just add the zip file, but I tried this and it didn't work.
Have you read the README.txt in the zip file with Curve API? Let me quote it:
In the src directory, there is a makejar.bat file. This file will
compile the nested Java files and create a Jar file called Capi.jar.
Compilation requires Java 1.2 or higher. After the Jar file is
created, add it to the classpath. Note: CAPI comes with MESP (Math
Expression String Parser).
If you use Windows Vista or 7 or 8, navigate to the folder with makejar.bat, hold Shift and right-click at an empty spot, and select "Open Command Window Here". It will launch console window with cmd.exe; you should be able to see a line like X:\Full\Path\To\The\Folder> in it.
If you use Windows XP or lower, then press Start button, select Run, and type cmd.exeEnter. Then enter cd "X:\Full\Path\To\The\Folder" (the path should be in quotes), and press Enter. If that folder is on the other drive than your current one (shown at the beginning of the prompt), then also type in the letter of the drive where that folder is located, the symbol :, and press Enter.
So much for opening the command window! Now type in makejar.batEnter. I predict that you will see an awful lot of 'javac' is not recognized as an internal or external command, operable program or batch file. lines. If that's so, then please locate javac.exe on your computer somehow—I suggest using Windows Search. After you locate it, go to the folder where it is; click on the address bar of that folder and copy the path to the buffer. Then switch back to the command window, type set PATH=", right-click and chose "Paste", type in ";%PATH%"Enter. After that, try makejar.batEnter—now it should work. If it does, you may also run makeapi.bat which will generate HTML documentation.

Adding Environment Variable in Windows 7

I am trying to use CMake and I need to add an environment variable GSL_ROOT_DIR in windows 7, so that %GSL_ROOT_DIR%\include contains the GSL header files and %GSL_ROOT_DIR%\lib contains the GSL libraries.
Could you tell me exactly how can I do that?
Press the start button. (alternatively: windows key + r, then sysdm.cpl)
right click "Computer" then click properties.
Click advanced system settings.
Click Environment variables.
Add the variable you need + the correct path.
EDIT:
point %GSL_ROOT_DIR% to the base directory of where you extracted the GSL library. I.e. if you downloaded the developer files from here and extracted it to c:\libs\gsl\ then your %GSL_ROOT_DIR% should be "C:\libs\gsl" (if you look at the zip file, it contains both an include, and a lib folder).