Skip to content

Instantly share code, notes, and snippets.

View ibki's full-sized avatar

Lim Ki-Sung ibki

  • Republic of Korea
  • 01:12 (UTC +09:00)
View GitHub Profile
@ibki
ibki / ChangeFileIcon.bat
Created December 21, 2020 06:27
Set the file icon for a specific extension.
rem Extension = .app1
rem Pass icon position to parameter
rem ex) ChangeFileIcon.bat "C:\App\Icon.ico"
@echo off
reg add "HKEY_CLASSES_ROOT\.app1" /f /ve /t REG_SZ /d APP1
reg add "HKEY_CLASSES_ROOT\APP1\DefaultIcon" /f /ve /t REG_EXPAND_SZ /d %1
rem Windows 10
@ibki
ibki / InstallScript.nsi
Last active December 23, 2020 14:35
Install script and check the version of .NET framework
Unicode true
!define PRODUCT_NAME "APP"
!define PRODUCT_ENGLISH_NAME "APP"
!define PRODUCT_VERSION ${VERSION}
!define PRODUCT_PUBLISHER "COMPANY"
!define PRODUCT_WEB_SITE "https://www.company.co.kr/"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_ENGLISH_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
!define PRODUCT_INFO_ROOT_KEY "HKCR"
@ibki
ibki / Install.bat
Last active December 23, 2020 14:34
Called makensis.exe and pass file version as parameter
set current_dir=%~dp0
FOR /F "USEBACKQ" %%F IN (`powershell -NoLogo -NoProfile -Command ^(Get-Item "%current_dir%\input\application.exe"^).VersionInfo.FileVersion`) DO (SET fileVersion=%%F)
"%ProgramFiles(x86)%\NSIS\makensis.exe" /DVERSION=%fileVersion% %current_dir%\InstallScript.nsi
rem pause
@ibki
ibki / PostBuildEvent.bat
Last active December 17, 2020 09:41
Move specific files to setup folder after release build
if $(ConfigurationName) == Release (
rmdir /s /q $(SolutionDir)\..\install\input
mkdir $(SolutionDir)\..\install\input
if not exist $(SolutionDir)\..\install\output mkdir $(SolutionDir)\..\install\output
copy $(TargetDir)*.config $(SolutionDir)\..\install\input
copy $(TargetDir)*.exe $(SolutionDir)\..\install\input
@ibki
ibki / CreateWindowsService.ps1
Last active December 15, 2020 07:13
Create a windows service with PowerShell
$serviceUserAccount = "ServiceUserName"
$serviceName = "ServiceName"
$displayName = "DisplayName"
$exeFilePath = "$(Get-Location)\Service.exe"
$description = "Testing services..."
# Create a service (local)user account
# another:
# > powershell -Command "New-LocalUser -Name $serviceUserAccount"
New-LocalUser -Name $serviceUserAccount