Add application to uninstall or change a program - windows

I have made a standalone exe using py-installer. It's easy to add my exe to the start menu. Simply add a shortcut to my program in the following directory.
os.getenv("PROGRAMDATA") + "\\Microsoft\\Windows\\Start Menu\\Programs"
However, my exe does not show up under Control Panel -> Programs -> Programs and Features. These applications let you right click to uninstall. How can I add my application to this list? I have made a standalone uninstall exe using py-installer that I want to run when the user clicks uninstall. How I can do this in a clean way? I think I have to add some registry keys. I always sign my exes.

1.Use Registry Editor (Regedit.exe) to view the following registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
2.Double-click the UninstallString registry value, copy the contents of the Value Data box by selecting the contents and pressing CTRL+C, and then quit Registry Editor.
3.Click Start, click Run, press CTRL+V to paste the uninstall command, and then click OK.
Some programs create a folder under the Winnt folder that contains a "$" character at the start and end of the folder name. This folder may contain an uninstall program that you can run to remove the program you previously installed on your computer. Note that these folders are usually hidden, and that you may need to configure Windows Explorer to view hidden files and folders. To do so, right-click Start, click Explore, click Options on the View menu, and then click Show all files.

Related

Open a folder in vscode through Finder in macOS?

On my windows pc, I would just double click a folder and click "Open in VS Code" to a open a folder, which saved time for me when looking through lots of code online. With Mac, however, I do not have this option. I have to directly open vscode and click "Open" to open a new folder. How do I directly open a file in vscode through finder in macOS?
2023 Update - Use Native Method
Open the Command Palette (Cmd+Shift+P) and type shell command to find the Shell Command: Install 'code' command in PATH command.
Restart all terminal sessions for the new $PATH value to take effect.
You'll be able to type code . in any folder to start editing files in that folder.
If you want to do it in Finder, you can write an Automator script to do it (it's easier than it sounds, AND shows you the power of the OS).
Launch Automator
Create New Document
Create a new Quick Action
Add the Action... (New Method - 10.13+)
Workflow receives current files or folders from Finder.
Add a new "Open Finder Items" action to the workflow. (drag the "Open Finder Items" object, highlighted in the screenshot, to the empty window on the right)
Select "Visual Studio Code" from the list.
Add the Action... (Old Method)
Workflow receives current files or folders from Finder.
Add a new Run Shell Script action to the workflow. (drag the "Run Shell Script" object, highlighted in the screenshot, to the empty window on the right)
Configure the Workflow (Old Method)
Set the Pass Input to be as arguments
Paste the following in the input box:
open -n -b "com.microsoft.VSCode" --args "$*"
Save the action using a name like Open in Visual Studio Code.
You may now right-click on the folder and find your newly created task under Quick Actions.
The simplest solution is to create a Quick Action with Open Finder Items:
This way you don't need a shell script that might break with an OS update or VS Code update
Launch Automator and select Quick Action or File > New > Quick Action If Automator is already open.
Set Quick Action receives selected to files or folders and in to Finder.
Choose an Image (icon) select Choose.. and double click Visual Studio Code in the window that pops up, this will set your quick action icon to the same as VS Code
Add Open Finder Items, Choose open with as Other.. select Visual Studio Code and save your Quick Action as Open in VSCode optionally choose an Image for your Quick Action job done.
Finally just hit Cmd+S to save and name it Open with VSCode
Well you need to understand. macOS has different ways to do things than windows and initially it might be a challenge. For starters you start to make use of Terminal. its beautiful.
Now answering your question.
Open your VS code and then, press CMD + SHIFT + P, type shell command and select Install code command in path. Afterwards, navigate to any project from the terminal and type code . from the directory to launch the project using VS Code.
Using the new shortcuts app.
Download:https://github.com/gluedpixel/shortcuts
Or create it by yourself
Open Shortcuts app > Quick Actions
Change from receive any to Files and Folders
Add run shell script action
Paste the code open -n -b "com.microsoft.VSCode" --args "$*"
Change input to Shortcut input
Click on Shortcut input and set type to "Folder" & Get to File Path
There are some ways suggested here in the VS Code GitHub Issues tracker, but I would go with the first option of dragging the folder onto the app icon if you have VS Code icon in your dock!
If you really want to be able to do so from a right click, then this repository has a workflow solution. https://github.com/Sankra/OpenFolderInVSCode
Drag and drop the folder from Finder onto an empty VSCode window.
Found a way to achieve a 'Quick Action' that met my needs using the following steps using MacOS' Shortcuts app (No Automator needed):
if you are looking for screenshots as well, I wrote a small Notion page
Open the ‘Shortcuts’ app on your Mac
On the Left Pane, navigate to ‘Quick Actions’
On the top bar, press the ➕ button to add New Shortcut.
Click on ‘Any’ and change to ‘Files and Folders’ by selecting only those from the dropdown that appears on clicking the ‘Any’ field.
Click on ‘Action Library’ on the right pane and search for ‘shell’. Drag and drop the ‘Run Shell Script’ onto the main pane. This will add the action to the Shortcut’s flow.
In the shortcut details (on the right pane), make sure Use as Quick Action is ticked and so are ‘Finder’ and ‘Service Menu’.
In the newly added action called ‘Run Shell Script’ write “code “ and right-click to get the below pop-up, go ahead ‘Insert variable’ and then ‘Shortcut Input’.
Click on the ‘Shortcut Input’ tag that appears. A pop must appear, choose ‘File Path’ and just click anywhere else. This will change the tag to ‘File Path’.
Set ‘Pass Input:’ option to ‘as arguments’.
Be sure to set a cool name for your new Shortcut! I named mine a boring “Open in VSCode”.
Open a new ‘Finder’ Instance, right-click on a folder, go to ‘Quick Actions’ > ‘Customize...’
Make sure your Shortcut’s Name is selected. Exit the dialogue and Test!
There is a Terminal command named code, I would stick with it and you should get used to it as well if you are regularly using VS.
Follow the one-time setup with-in VS Code
Open your VS code and press ⌘ CMD + SHIFT + P
Type shell, and select Shell Command: Install 'code' command in PATH from the list
Open Terminal and hit any of the commands below:
code <path-to-folder>
OR
cd <path-to-folder>
code .
OR
cd <path-to-folder> && code .
I've actually managed to have it as an icon you can just add to the Finder window as such:
The script will allow you to open the current folder path in VSCode.
The steps to do so are:
Create a new Application with Automator
Select the "Run shell script" from the menu and drag it to the editor
Paste the following small script to the text area:
finderPath=`osascript -e 'tell application "Finder" to get the POSIX path of (target of front window as alias)'`
open -n -b "com.microsoft.VSCode" --args "$finderPath"
Save the Application to the Applications folder
Right click the app and drag and drop your desired VSCode icon to the blank area to the left of the name and close the Get Info window
Press and hold the Command key and drag the Application to an empty space in the Finder title row like in the picture
Test that it works by pressing on the icon. VSCode should now open with the content of the current folder in the navigation bar
Here is an alternative derived from the accepted answer.
Indeed the accepted solution by #jnovack just opens VS Code for me, but not the desired folder. If VS Code is already running it just switches the focus to a running instance of VS Code.
Solution
Provided that you have the code CLI command installed (if not, go to VS Code and do CMD+SHIT+P>"Shell Command: install 'code' in PATH")
Then open a terminal and run which code. You should get the code executable path looking somethin like /usr/local/bin/code
Then, as per #jnovack 's answer,
Open Automator
Create a new Document (CMD+N)
Create a new Quick Action
Workflow receives current files and folders from Finder.
Add a new Run Shell Script action to the workflow. (drag and drop the "Run Shell Script" object)
Pass input as arguments
Paste this code in the shell command field /usr/local/bin/code -n "$*" or replace with your path to the code executable if it differs from this one.
Save the action
Tbh. I would have expected to be able to use just code -n "$*", but for some reason, the PATH used by the automator's shell seems to be different from that used in the terminal. I'd welcome some input on that matter.
I find this to be the best solution out there:
https://github.com/RoadToDream/SzContext

Issue with all the window icons

I was opening dreamweaver file. it opened open with option i check the dreamweaver and didnt noticed that always open this type of file was checked, now all the .lnk extension files changed to dreamweaver. i cant open any shortcut. please help me solve the issue
It seems like the registry is changed. I have been having this problem myself before and I had to download a .reg file that fixed the issue.
Windows 7, 8 and Vista(This downloads a .txt file possibly, remove file extension .txt and leave the .reg extension): Click Here.
Windows XP: Click here.
You can fix this yourself in the registry editor by doing the following:
Click Start Menu, and then type regedit in the Start Search and press ENTER.
Browse to the following registry branch:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts.lnk
Click on the arrow to expand it and delete the sub-key named UserChoice.
Exit from Registry Editor and reboot your machine.

How to associate an extension with a program if the extension is not in the "Default Programs" list in Windows Seven?

In Windows Seven, I'm aware of the "Default Programs" dialog in Control Panel, which lets me associate pre-defined extensions with programs. However, I need to add an association for a file extension that isn't in the list. In WinXP, I'm pretty sure I could add entries to the list, but that doesn't appear to be immediately available in Windows Seven.
If you select a file with the desired extension in Explorer and click on it, a dialog box pops up that lets you select a program from a list. Click that. Then you can CLick on "Browse..." and select the program you want the file to be opened with. I have not tried, but you might be able to change it through the Default Programs afterwards.

.net .vdproj - application shortcut

I'm creating a .vdproj setup for a simple Windows form. I have added a shortcut to the user's program menu (in a folder), but when I click the shortcut, it just opens the install folder. How do I set it up to run the .exe program?
I just tried putting the .exe name in the "Argument" for the shortcut - no luck yet. I thought it might be more intuitive than that. It also seems like "Target" might be the property to set - but it gives me a pick list - and my .exe is not in the list of things to pick.
Thanks,
Neal Walters
Update 1:
I'm using VS2008 SP1.
I added a folder under "User's Program menu" called "RCT" (that's my application name). I right click on that folder and I see "Add" with an arrow to submenu and "Create shortcut to RCT". The first thing I tried was the "Create shortcut to RCT", which is what lead me to post this question. Once the shortcut is there, it looks like the Properties Windows is the only way to configure it.
I set the "Target", and "Working Folder" (all 3 properties) to "Application Folder".
Now when I click the shortcut, it opens disk directory: C:\Users\uxnxw01\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\RCT
If I right click on "User's Program Menu" I see a link "Add shortcut to user's program menu". I really want a shortcut "in" the user's program menu, not "to" the user's program menu.
The "Add" submenu has four options: Folder, Project Output, File, Assembly.
SOLUTION - based on Heinzi's response:
I think I got it now - you right-click on the white space (under "name ... type..."- not on the folder. Then I see "create new shortcut". What a confusing design on the part of Microsoft! Seems like you would click on the folder and "add new shortcut". Instead they give you "Add shortcut to..." the item you click on.
After clicking on Create New Shortcut, instead of selecting the application folder, double-click on the application folder. Then Primary output from <YourApplication> should be selectable.

Document icon changes after first launch on Windows

I have an application that gets installed with a Wise installer (EDIT: Wise creates a Setup.exe file, not an MSI). Upon installation, an icon is set for a certain file type:
HKEY_CLASSES_ROOT\.auz\DefaultIcon = C:\Path\To\App\some_icon.ico,0
Right after the installation, however, Explorer chooses to display this icon using the generic "white sheet + application icon" icon, which is different (and not provided by me).
Upon first launch, the application itself registers icons and other file associations, so that the last run version "owns" those documents. At that point, Explorer changes the icon for this file type and displays the correct one, but when I look at the registry, the value for DefaultIcon is exactly the same.
This is what I've tried so far
Removing all entries from the registry, and writing them myself.
After the installation, "touching" the value of DefaultIcon, and then launching a small little program that only calls SHChangeNotify(SHCNE_ASSOCCHANGED) (my program does this after updating the file associations in the registry).
After the installation, killing and restarting Explorer.
After the installation, using TweakUI to "repair" the icons on the desktop.
None of these work. The only way to get the correct icon is to let the program itself install it. I can't find any change in the registry. I'm pulling my hair off.
What I would like to avoid
Testing with another installer software
Changing the installation script too much (I don't have Wise itself, as the installer gets built on another machine on demand).
Embed the icons in the executable.
Any suggestions on how to get Explorer to display the correct icon after installation?
A couple of things come to mind:
why do you have the ',0' after the icon in the registry? That would limit the shown icon to one single icon. Better would be to have an icon file which contains several icons (same icon UI but different sizes/color depths) - Explorer has different icon views! Try removing the ',0' if your icon file only has one icon in it.
it may be that the registry is written last in the installer, after the explorer got notified of updates?
make sure the registry entry is written after the icon file is stored on disk
you should use the Wise installers own configuration to register the file type. Not sure, but I think explorer won't take any changes until the whole installation of an msi is finished, so calling SHChangeNotify() manually won't help. The msi has its own table for this, which Wise will add if you use the right configuration.
For Wise, do the following (instead of creating the registry keys on your own):
Under the Feature Details page group, select the File Associations page.
From the Current Feature drop-down list, select Core.
Click Add at the right of the window and select New.
The File Association Details dialog appears.
Click the Extension Details tab.
Browse to the QuickFacts directory, select the file QckFacts.exe, and click OK.
In Extension, enter: qft
Leave the defaults for the rest of the fields and click OK.
The extension .QFT is added to the installation. When an end user double-clicks a
file with this extension on the destination computer, the QuickFacts application
launches.
Save the installation
[Edit]
You may also missing required registry entries (the icon might not be enough for the shell to show it):
HKEY_CLASSES_ROOT\.auz\(default) = auzfile
HKEY_CLASSES_ROOT\.auz\shell\open\command = C:\Path\To\App.exe
Here's the solution.
Each file type (let's say ".auz" in this case) was registered with:
A DefaultIcon key with the path to the icon resource, and
A value for the HKEY_CLASSES_ROOT\.auz\(default) value giving a description of the file type, e.g. "Foobar Document".
In addition to this, there was an entry for the "Foobar Document" document type, or more specifically, a key for how to open such documents from the shell:
HKEY_CLASSES_ROOT\Foobar Document\Shell\command\open\(default) = C:\Path\To\App.exe "%1"
Apparently, this key supersedes the value written for the specific file extension. Because the icons are external to the .exe file, Windows Explorer then used the first icon of the application to create an icon for all files of type "Foobar Document" (that "white sheet + application icon" icon I mentioned).
Now, what I had wrong was that the application itself does change the value of
HKEY_CLASSES_ROOT\.auz\(default)
to a slightly different value when starting, say "Foobar 1.2 Document" (the problem with not being DRY). Thus, the link to "Foobar Document" was lost, and the .auz files got their icons after the first launch.
So I fixed this all by simply removing the HKEY_CLASSES_ROOT\Foobar Document key altogether, and voilà!

Resources