How do I get the version number of an installed app on Windows? - windows

I want to get version numbers of applications installed on Windows with Flutter. I tried to do this with tools like regedit or wmic using shell commands.
Thank you from now.
Example :
With package "process_run: ^0.12.5+2";
var shell = Shell(); final result = await shell.run( 'reg query HKLM\\SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall /s');
When I use the command I can search all applications and I get a list of results like this
AuthorizedCDFPrefix REG_SZ
Comments REG_SZ
Contact REG_SZ
DisplayVersion REG_SZ 14.32.31332
HelpLink REG_SZ
HelpTelephone REG_SZ
InstallDate REG_SZ 20221224
InstallLocation REG_SZ
InstallSource REG_SZ C:\ProgramData\Microsoft\VisualStudio\Packages\Microsoft.VisualCpp.RuntimeDebug.14,version=14.32.31332,chip=x86\
ModifyPath REG_EXPAND_SZ MsiExec.exe /I{F98134CC-02C9-4B94-B2B0-5D6B2F5F2F76}
Publisher REG_SZ Microsoft Corporation
Readme REG_SZ
Size REG_SZ
EstimatedSize REG_DWORD 0x61b2
SystemComponent REG_DWORD 0x1
UninstallString REG_EXPAND_SZ MsiExec.exe /I{F98134CC-02C9-4B94-B2B0-5D6B2F5F2F76}
URLInfoAbout REG_SZ
URLUpdateInfo REG_SZ
VersionMajor REG_DWORD 0xe
VersionMinor REG_DWORD 0x20
WindowsInstaller REG_DWORD 0x1
Version REG_DWORD 0xe207a64
Language REG_DWORD 0x409
DisplayName REG_SZ Microsoft Visual C++ 2022 X86 Debug Runtime - 14.32.31332
but I want to know the version number of that application by giving the path of a particular application
The function I want looks like this:
Future<String?> getApplicationVersion(String installLocation) async {}
actually there is a package that meets exactly what I want but it only works on android I need windows alternative of this package(device_apps: ^2.2.0)

Related

Updating Image File Execution Options with reg command, why is both 64but and 32bit keys updated?

I'm updating Image File Execution Options with reg command
reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe" /v "Debugger" /t REG_SZ /d "\"c:\windows\Notepad2.exe\" /z" /f
And both 64bit keys and 32bit keys are updated, why?
And if delete the wow6432node key with regedit, the 64bit key is gone as well.
Does anyone know what's happening?

How to get the current screensaver on Windows?

Either using Regedit or using command prompt, I need to learn the active screensaver file. Without using the screensaver settings window, of course.
reg query "HKCU\Control Panel\Desktop" -v sc*
HKEY_CURRENT_USER\Control Panel\Desktop
ScreenSaveActive REG_SZ 1
ScreenSaverIsSecure REG_SZ 0
ScreenSaveTimeOut REG_SZ 300
SCRNSAVE.EXE REG_SZ C:\WINDOWS\system32\Mystify.scr
End of search: 4 match(es) found.
Above code works for standard Windows screensavers (defined as follows and Blank); didn't try Photos.
reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Screensavers"
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Screensavers\Bubbles
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Screensavers\Mystify
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Screensavers\Ribbons
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Screensavers\ssText3d
Possible executables:
where *.scr
C:\Windows\System32\Bubbles.scr
C:\Windows\System32\Mystify.scr
C:\Windows\System32\PhotoScreensaver.scr
C:\Windows\System32\Ribbons.scr
C:\Windows\System32\scrnsave.scr
C:\Windows\System32\ssText3d.scr

Enabling developer mode on Windows 10 Build build 10074

Windows 10 Insider Preview build 10074 has a known issue using the Settings application to enable developer mode. In this build, if you try Settings/Update & Security/For developers... the settings window suddenly closes.
Is there a workaround?
Yes, there's a work-around. In an administrator command prompt, type the following commands:
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" /t REG_DWORD /f /v "AllowAllTrustedApps" /d "1"
Then reboot the machine to enable developer mode

How to set value in registry via batch file in Windows?

I am going to set a value to windows registry.
I want to set variable shit for StupidMS in registry, but the result is wrong. Following is my code.
set stupidMS=shit
echo %stupidMS%
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run" /v "StupidMS" /t REG_SZ /d ^%stupidMS^%
I think the problem is ^%stupidMS^%, but I quite have no idea how to correct it.
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run" /v "StupidMS" /t REG_SZ /d "%stupidMS%"

How to make Unicode charset in cmd.exe by default?

866 charset installed by default in Windows' cmd.exe is poor and inconvinient as compared with glorious Unicode.
Can I install Unicode by default or replace cmd.exe to another console and make it default so programms use it instead of cmd.exe?
I understand that chcp 65001 changes encoding only in the running console. I want to change charset at the system level.
After I tried algirdas' solution, my Windows crashed (Win 7 Pro 64bit) so I decided to try a different solution:
Start Run (Win+R)
Type cmd /K chcp 65001
You will get mostly what you want. To start it from the taskbar or anywhere else, make a shortcut (you can name it cmd.unicode.exe or whatever you like) and change its Target to C:\Windows\System32\cmd.exe /K chcp 65001.
Open an elevated Command Prompt (run cmd as administrator).
query your registry for available TT fonts to the console by:
REG query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont"
You'll see an output like :
0 REG_SZ Lucida Console
00 REG_SZ Consolas
936 REG_SZ *新宋体
932 REG_SZ *MS ゴシック
Now we need to add a TT font that supports the characters you need like Courier New, we do this by adding zeros to the string name, so in this case the next one would be "000" :
REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont" /v 000 /t REG_SZ /d "Courier New"
Now we implement UTF-8 support:
REG ADD HKCU\Console /v CodePage /t REG_DWORD /d 65001 /f
Set default font to "Courier New":
REG ADD HKCU\Console /v FaceName /t REG_SZ /d "Courier New" /f
Set font size to 20 :
REG ADD HKCU\Console /v FontSize /t REG_DWORD /d 20 /f
Enable quick edit if you like :
REG ADD HKCU\Console /v QuickEdit /t REG_DWORD /d 1 /f
Save the following into a file with ".reg" suffix:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Console\%SystemRoot%_system32_cmd.exe]
"CodePage"=dword:0000fde9
Double click this file, and regedit will import it.
It basically sets the key HKEY_CURRENT_USER\Console\%SystemRoot%_system32_cmd.exe\CodePage to 0xfde9 (65001 in decimal system).
For me, for Visual Studio 2022, it worked when I executed this ".reg" command.
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Console\C:_Program Files_Microsoft Visual Studio_2022_Professional_Common7_IDE_CommonExtensions_Platform_Debugger_VsDebugConsole.exe]
"CodePage"=dword:0000fde9
It is based on #Shaohua Li's answer: https://stackoverflow.com/a/24711864/2941313. It does the same thing but for different path (specifically for VS2022 console).

Resources