如何创建为程序文件和程序文件(x86)的工作,一个批处理文件? [英] How to create a batch file which work for both Program Files and Program Files(x86)?

查看:90
本文介绍了如何创建为程序文件和程序文件(x86)的工作,一个批处理文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建一个批处理文件自动一个.sql文件复制到安装碧玉服务器的路径(它可以是任何软件的安装目录)。

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 \\ -u的mysql.exe根-proot< create_database.sql

C:\PROGRA~2\JASPER~1.0\mysql\bin\mysql.exe -u root -proot < create_database.sql

这时候碧玉安装在Program Files文件(x86)的工作。
我怎么能概括它为程序文件和程序文件(x86)。

that is working when jasper is installed in Program Files(x86). How can i generalize it for both Program Files and Program Files(x86).

推荐答案

您想使用环境变量来查找这样的事情。在32位的Windows,的%ProgramFiles%是你的朋友。

You want to use environment variables to look up things like this. On 32bit Windows, %ProgramFiles% is your friend.

在64位的Windows,事情有点复杂,随着应用程序既可以在的%ProgramFiles%安装和的%ProgramFiles(x86)的%

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.

修改
看见的 NSIS 的标签 - 你创建一个安装程序?在这种情况下,恒定 $ PROGRAMFILES 的可能是有用的。

Edit Saw the nsis tag - are you creating an installer? In that case the constant $ProgramFiles might be useful.

这篇关于如何创建为程序文件和程序文件(x86)的工作,一个批处理文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆