Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a batch file which work for both Program Files and Program Files(x86)?

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).

like image 585
Sharad Avatar asked Apr 09 '12 09:04

Sharad


People also ask

How do I make a program into a batch file?

To create a Windows batch file, follow these steps: Open a text file, such as a Notepad or WordPad document. Add your commands, starting with @echo [off], followed by, each in a new line, title [title of your batch script], echo [first line], and pause. Save your file with the file extension BAT, for example, test.

How do I use program files x86 in command prompt?

While in the command prompt type "cd\", then enter. From there type "cd\program" then hit the tab button until you see "c:\program files (x86)", then hit enter.

Do I need program files and program files x86?

It doesn't normally matter whether a program's files are stored in Program Files or Program Files (x86). Windows automatically installs programs to the correct folder, so you don't have to think about it. Programs appear in the Start menu and function normally, no matter where they're installed.


1 Answers

Here is how I do it:

GOTO %PROCESSOR_ARCHITECTURE%

:AMD64
<64Bit code>
EXIT

:X86
<32bit code>
EXIT
like image 53
Adam Avatar answered Oct 03 '22 01:10

Adam