How to override Windows' convert command by ImageMagick's one? - windows

In Windows, a command called convert is used to convert the filesystems. When you type convert, it will ask you to specify a filesystem.
In ImageMagick, convert command is used for image processing.
The problem is, even after setting the environment variable for ImageMagick convert, the tool doesn't get invoked. It calls only the Windows convert command. How to override that?

This is an old question, but the current solution with ImageMagick 7 is to use the "magick" command in place of "convert".

This is an old question, but I encountered this problem today, and this is my solution in Windows 7.
Windows convert.exe is located in folder C:\Windows\System32, so you have to modify the Windows PATH variable by putting the ImageMagick path (for example C:\Libs\ImageMagick-6.8.8-4) before the path that loads System32 (ie. %SystemRoot%\System32).
This will cause all ImageMagick executables to take priority over any similarly named system executables, which should do what you want but may cause unexpected behaviour.
Also, when you want to use the system convert.exe, you'll have to specify the full pathname such as C:\Windows\System32\convert.exe.

Renaming the ImageMagick convert.exe worked well for me.
I didn't like using full path each time, and changing the system PATH variable isn't possible for me on the work PC.
After renaming convert.exe to imgconvert.exe, no other changes were needed. You could now use the new command anywhere from the command line without it being confused with the intrinsic Windows file system convert
Edit: As of version 7.0, the command is now magick.exe, which no longer clashes with any native windows commands. So downloading the latest version if possible should solve the problem as well.

Did you logoff and login?
Or specify the Imagemagick's convert by providing the complete path

In powershell you can run this: $env:Path = "C:\path-to-convert\;$env:Path"
Now the imagemagick convert exe gets found because it comes first in the path.

Related

julia executable path in vscode on windows

I am trying to get Julia to run on VSCode on windows. I cannot get julia Language server to run. The executable path = "C:\Julia-1.1.1\bin\" which is the correct path. Where am I going wrong?
As stated in the parameter's description, the path should point to the julia executable. You need to add julia.exe to the end.
C:\Julia-1.1.1\bin\julia.exe
If you are editing the JSON file directly, you will need to escape the backslashes.
C:\\Julia-1.1.1\\bin\\julia.exe
The following setting works for me, without the .exe extension.
"julia.executablePath": "C:\\Users\\...\\Julia-1.3.0\\bin\\julia"

Windows command for image compression returns Invalid Parameter Error

I am trying to run the below command to compress file size of images on Windows system and it returns error message:
Invalid Parameter 70
for %f IN (*.png) DO convert -quality 70 "%f" "%f"
I tried searching in world wide web for a solution, but couldn't find anything.
Is the syntax of the command wrong?
OR
Does this not work at all?
What am I missing here?
You have to specify the full path to your convert command (ex: if you installed convert.exe to C:\myprogs provide C:\myprogs\convert.exe in your for loop) or DOS will use the built-in convert command , which is completely different (NTFS/FAT volume conversion)
On my machine (I haven't installed any convert programs):
C:\Users\xxxx>where convert
C:\Windows\System32\convert.exe
The built-in windows commands always come first in the PATH.
Slightly off-topic to explain a similar problem: When people try to call MSYS find or sort or generic named commands like that within the Windows command line. Other commands like sed or grep work fine because they don't exist in MS-DOS, but Windows find or sort exist and come first, unless ran from MSYS2 shell (not to mention: the user's script miserably fail as the commands meaning & syntax are different)
As seen in the other comments, I suppose you're mixing up with compact command.
compact command is a compression program, very unlikely to efficiently pack your images. You really need the ImageMagik package. Irfanview is not a command-line tool but has a nice batch mode which works well.

When to use .exe and when not?

I dont really understand whats going on and cant see the difference:
I'm downloaded the base64.exe for creating base64 text under windows. i copied it to C:\Windows\ because its in the %PATH% variable.
Now i want to try it: echo Hello | base64 works great. Okay i dont need to append .exe and as far as i know i dont need to do it also with .bat and .com files.
But now i have some cygwin tools installed and for example tried which base64, which doesnt work, because it says that base64 is not in path. Then i typed in which base64.exe and got C:\Windows.
So my question is now: when i need to use .exe and when i dont? Is it only when i'm using cygwin tools that i need to append .exe?
Cygwin is a shell which emulates UNIX behaviour. UNIX doesn't know anything about .exe, thats why Cygwin can't find base64.exe. Under UNIX, binaries are stored without an extionsion added to their filename, e.g. just base64.
Windows CMD automatically appends .bat, .com, .exe and the like to your file names. Cygwin does not. So if you are using a linux shell you have to append it manually.
Since Cygwin is aware that it always runs under Windows it might append .exe if you want to perform certain actions in the shell itself (e.g. opening a file), to behave more friendyl to Windows users who expect this behaviour. However programs running under Cygwin might not integrate those features since they were mainly devoloped for usage under UNIX. That could be a reason why which base64 fails.

Windows 7 32-bit Program Files path in a Batch file Issue

I have batch file that I am inheriting and I cannot get to work in a 64bit Windows 7 environment. The batch file makes a call to a java script, and passes two variables in it. The old on looked like this:
C:\Progra~1\salesf~1.com\ApexDa~2.0\bin\process.bat C:\Progra~1\*PATH* *VARIABLE*
This was run onm 32bit XP which has just the one program files. I have tried every way I can think of to change the being of the the path to Program fiels x86. I have tried SET PATH, SET ExecPath, %ProgrmaFiles(x86), but they all return cannot find the path specified. I am sure the answer is easy, and I know there is a much beeter way to do this, and it will be changed, but for the moment, I need this to work. Any help, much appreciated.
If you type
dir /x c:\
then this shows the directory listing in the 8.3 format. Program Files expands to PROGRA~1 and Program Files (x86) expands to PROGRA~2. So I think you'll need to change the script to use PROGRA~2
EDIT: I agree with Mark that this isn't ideal -- it depends how much you are able to change of the legacy scripts. On a Win7 machine you should be able to use %ProgramFiles% and %ProgramFiles(x86)% (note the trailing '%').
export JAVA_HOME=/cygdrive/c/Progra~1/java/jdk1.7.0_40/
This worked for me.

attempting to assign alias to path of an exe file in dos shell

I want to set an alias to my installation of firefox so I can easily start a web page, the problem is that I dont want the script to be system dependent.
Namely I want it to be able to run on a linux distribution where the command to start firefox is already mapped to 'firefox' and can easily be run that way through bash, but on my windows machine I cant seem to get it to assign to the same variable.
I saw that I could set it to '%firefox%' via the set command but that's not quite what I want.
I believe creating aliases is possible on a windows environment because the version of svn that I use auto-installed and was able to assign itself to 'svn'. Anyone know what was involved in them being able to get their alias working, or a similar way to alias a command?
If you include your Firefox path in the %PATH% environment variable, you can start FF with "firefox". Under Windows, you should edit the system-wide settings (see this link).
AFAIK, there is nothing similar to aliases under DOS/Windows (except the %firefox% way you mentioned, too). The 'svn' command you talked about most likely is the same thing, a 'svn.exe' and its path included to %PATH%.
This is a bit restrictive, as you can only use the original filename to launch a program, but you can work around this by creating a batch file in the program's path that launches the program, f.e. a FF.BAT that contains "firefox %1".
Alternatively, you can place a batch file in a path that already is in %PATH%, f.e. the Windows directory. That way, you don't have to modify %PATH%.

Resources