I have created a batch file which automatically copy a .sql file to the path of installed Jasper server(it could be any software installation directory).
This is my batch script–
C:\PROGRA~2\JASPER~1.0\mysql\bin\mysql.exe -u root -proot < create_database.sql
that is working when jasper is installed in Program Files(x86).
How can i generalize it for both Program Files and Program Files(x86).
You want to use environment variables to look up things like this. On 32bit Windows,
%ProgramFiles%is your friend.On 64bit Windows, things are a little more complicated, as application can be installed both in
%ProgramFiles%and%ProgramFiles(x86)%.If you cannot look up the location of Jasper some other way (registry? installed program settings?), your best bet is to look in both places and take the one where you find the expected directory.
Edit
Saw the nsis tag – are you creating an installer? In that case the constant $ProgramFiles might be useful.