I wrote this script to first install the msi and then copy my application to a temporary directory. But none is working. When the windows.bat file is executed it failed to find package\ and also dist directory
1) User downloaded and execute the windows.bat file which has following tree:
C:\Users\Username\Downloads\windows.bat
C:\Users\Username\Downloads\package\<.msi files>
C:\Users\Username\Downloads\dist\<application files>
2) windows.bat contain below:
msiexec /I "package\files.msi" /qb
set temp=%TEMP%
echo %temp%
xcopy dist %temp% /e /h /R
All fails, to run with windows.bat file. What am i doing wrong?
You need to add the following line to the beginning of your batch file:
alternatively, you can do this:
%~p0 will take argument #0 (the full path to the batch file) and extract the path from it. The /d option will make sure to also change the current drive if the given path contains a drive specification.