diff --git a/fluent-package/msi/assets/fluent-gem.bat b/fluent-package/msi/assets/fluent-gem.bat
index 2f67dd6a7..a050e33d9 100644
--- a/fluent-package/msi/assets/fluent-gem.bat
+++ b/fluent-package/msi/assets/fluent-gem.bat
@@ -1,12 +1,12 @@
@echo off
if "%~nx0" == "td-agent-gem.bat" (
- set FLUENT_PACKAGE_TOPDIR=%~dp0..\
+ set "FLUENT_PACKAGE_TOPDIR=%~dp0..\"
) else (
- set FLUENT_PACKAGE_TOPDIR=%~dp0
+ set "FLUENT_PACKAGE_TOPDIR=%~dp0"
)
-set FLUENT_PACKAGE_BINDIR=%FLUENT_PACKAGE_TOPDIR%bin
-set PATH="%FLUENT_PACKAGE_BINDIR%";%PATH%
-for /f "usebackq" %%i in (`%FLUENT_PACKAGE_BINDIR%\ruby.exe -rrbconfig -e "print RbConfig::CONFIG['ruby_version']"`) do set RUBY_VERSION=%%i
-set GEM_HOME=%FLUENT_PACKAGE_TOPDIR%lib\ruby\gems\%RUBY_VERSION%
-set GEM_PATH=%FLUENT_PACKAGE_TOPDIR%lib\ruby\gems\%RUBY_VERSION%
-%FLUENT_PACKAGE_BINDIR%\fluent-gem %*
+set "FLUENT_PACKAGE_BINDIR=%FLUENT_PACKAGE_TOPDIR%bin"
+set PATH=%FLUENT_PACKAGE_BINDIR%;%PATH%
+for /f "usebackq" %%i in (`^""%FLUENT_PACKAGE_BINDIR%\ruby.exe" -rrbconfig -e "print RbConfig::CONFIG['ruby_version']"^"`) do set RUBY_VERSION=%%i
+set "GEM_HOME=%FLUENT_PACKAGE_TOPDIR%lib\ruby\gems\%RUBY_VERSION%"
+set "GEM_PATH=%FLUENT_PACKAGE_TOPDIR%lib\ruby\gems\%RUBY_VERSION%"
+"%FLUENT_PACKAGE_BINDIR%\fluent-gem" %*
diff --git a/fluent-package/msi/assets/fluentd.bat b/fluent-package/msi/assets/fluentd.bat
index 393ca0b8c..d3ca83a87 100644
--- a/fluent-package/msi/assets/fluentd.bat
+++ b/fluent-package/msi/assets/fluentd.bat
@@ -1,8 +1,8 @@
@echo off
if "%~nx0" == "td-agent.bat" (
- set FLUENT_PACKAGE_TOPDIR=%~dp0..\
+ set "FLUENT_PACKAGE_TOPDIR=%~dp0..\"
) else (
- set FLUENT_PACKAGE_TOPDIR=%~dp0
+ set "FLUENT_PACKAGE_TOPDIR=%~dp0"
)
@rem Convert path separator from backslash to forwardslash
@@ -11,9 +11,9 @@ set FLUENT_PACKAGE_TOPDIR=!FLUENT_PACKAGE_TOPDIR:\=/!
set PATH=%FLUENT_PACKAGE_TOPDIR%bin;%PATH%
set PATH=%FLUENT_PACKAGE_TOPDIR%;%PATH%
-set FLUENT_CONF=%FLUENT_PACKAGE_TOPDIR%/etc/fluent/fluentd.conf
-set FLUENT_PLUGIN=%FLUENT_PACKAGE_TOPDIR%/etc/fluent/plugin
-set FLUENT_PACKAGE_VERSION=%FLUENT_PACKAGE_TOPDIR%/bin/fluent-package-version.rb
+set "FLUENT_CONF=%FLUENT_PACKAGE_TOPDIR%/etc/fluent/fluentd.conf"
+set "FLUENT_PLUGIN=%FLUENT_PACKAGE_TOPDIR%/etc/fluent/plugin"
+set "FLUENT_PACKAGE_VERSION=%FLUENT_PACKAGE_TOPDIR%/bin/fluent-package-version.rb"
for %%p in (%*) do (
if "%%p"=="--version" (
ruby "%FLUENT_PACKAGE_VERSION%"
diff --git a/fluent-package/msi/source.wxs b/fluent-package/msi/source.wxs
index 7bd982642..faeb7f1b7 100644
--- a/fluent-package/msi/source.wxs
+++ b/fluent-package/msi/source.wxs
@@ -185,7 +185,7 @@
+ Value=""[FLUENTPROJECTLOCATION]fluentd.bat" --reg-winsvc i --reg-winsvc-delay-start --reg-winsvc-fluentdopt "-c '[FLUENTPROJECTLOCATION]etc\fluent\fluentd.conf' -o '[FLUENTPROJECTLOCATION]fluentd.log'""/>
+ Value=""cmd" /c "fsutil hardlink create ^"[FLUENTPROJECTLOCATION]bin\td-agent.bat^" ^"[FLUENTPROJECTLOCATION]fluentd.bat^"""/>
+ Value=""cmd" /c "fsutil hardlink create ^"[FLUENTPROJECTLOCATION]bin\td-agent-gem.bat^" ^"[FLUENTPROJECTLOCATION]fluent-gem.bat^"""/>
+ Value=""cmd" /c "del ^"[FLUENTPROJECTLOCATION]bin\td-agent.bat^"""/>
+ Value=""cmd" /c "del ^"[FLUENTPROJECTLOCATION]bin\td-agent-gem.bat^"""/>