ImageMagick, "which" is not recognized as an internal or external command - imagemagick

I just installed ImageMagick on my windows machine so I can use it with the paperclip gem with RUby on Rails. When I try to run "which convert" into the command prompt, it returns a 'which' is not recognized as an internal or external command,
operable program or batch file.
I am relatively new to command prompt and still trying to learn as much as I can. What is wrong with my command and how do I fix it?

The command is right. The OS is wrong.
which is a unix command not a windows one.
See the equivalent Windows command

Just use the following command on Windows:
where package_name

Related

I can't create a global gitignore in my terminal. touch ~/.gitignore gives an error

I am trying to create a global .gitignore file with this command:
touch ~/.gitignore
but in my terminal (Cmder) gives this message: "touch: cannot touch '~/.gitignore': No such file or directory"
I have changed to windows terminal default (Command Prompt) and it says:
"'touch' is not recognized as an internal or external command, operable program or batch file."
What I am doing wrong or what can I do to solve this?
You are using linux syntax. Now, even though touch is not understood by cmd prompt, it is a command understood by cmder but expression ~/.gitignore is still linux way of saying things.
What you can do on cmd prompt, I guess also would work on cmder (edit: doesn't seem to work for cmder):
copy con "%USERPROFILE%\.gitignore"
[press F6 and enter after that]
For cmder, this could work:
touch "%USERPROFILE%\.gitignore"
This should help for windows terminal:
echo $null >> pot.txt
touch is linux command not windows command.
Below question should help a lot more :
https://superuser.com/questions/502374/equivalent-of-linux-touch-to-create-an-empty-file-with-powershell

Trying to run the command 'appium-doctor' on Windows Command Prompt but getting an error

I installed Appium Desktop for windows and used the Command Prompt to install Appium server and appium-doctor via npm but I get the following error after typing 'appium-doctor' in the command prompt:
'appium-doctor' is not recognized as an internal or external command, operable program or batch file.
How can I get appium-doctor to run?
Edit: I found out what was wrong. In %PATH%, I had two variable locations written down in the same line separated by a semicolon:
C:\Users\xyz\AppData\Roaming\npm;C:\Program Files\nodejs
I removed the semicolon and put the two variable locations in different lines:
C:\Users\xyz\AppData\Roaming\npm
C:\Program Files\nodejs
Everything is working now
you either need to specify the full path in cmd, or add the path to the executable in your os PATH environment variable

rails s command does not run from ssh

I am using Putty to connect to my localhost, and I don't have any problems apparently, however, when I run command rails s to start my rails 4.0.0 application from Putty, it gives me this message:
jose#jose-laptop:~/rails/dedicated-agenda$ rails s
The program 'rails' can be found in the following packages:
ruby-railties-3.2
ruby-railties-4.0
Try: sudo apt-get install
I don't get that message from the terminal though, the application starts running just fine.
I had to reinstall ubuntu so I upgraded to ubuntu 14.04 just in case you need to know.
I don't know if I am missing something in my ssh settings or how could I use rails s from Putty.
Thanks in advance.
Your PATH environment variable is set differently when you are executing programs in an interactive shell and by ssh(using putty).
Use absolute path of the program to not depend on the PATH variable.
You can also set the right PATH variable at ~/.profile file and load the updated variables using the command source ~/.profile.
Now, you should be able to run the command.
You can use the command
>which rails
to see where rails is installed on your working session.
Then you need to make sure that is in your path when you ssh in.
If you are ssh'ing in as a different use then that user may not have permission to see the rails executable.

How do I configure Cygwin to search using the PATHEXT environment variable?

I am trying to run Rails under Cygwin but when I type "rails -v" it finds "rails" and throws an error. When I type "rails.bat -v" it works just fine. Either works fine in the native Windows command processor because it uses PATHEXT to identify executables like .BAT.
I added a line to .bash_profile as follows and it is setting the variable, as far as I can tell.
export PATHEXT=".RB;.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC"
This is my output:
$ echo $PATH
/usr/local/bin:/usr/bin:/cygdrive/c/Program Files/Common Files/Microsoft Shared/Windows Live:/cygdrive/c/Program Files (x86)/Common Files/Microsoft Shared/Windows Live:/cygdrive/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Program Files/WIDCOMM/Bluetooth Software:/cygdrive/c/Program Files/WIDCOMM/Bluetooth Software/syswow64:/cygdrive/c/Program Files (x86)/Windows Live/Shared:/cygdrive/c/Program Files/Intel/WiFi/bin:/cygdrive/c/Program Files/Common Files/Intel/WirelessCommon:/cygdrive/c/Program Files/Microsoft Windows Performance Toolkit:/cygdrive/c/Program Files (x86)/QuickTime/QTSystem:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0:/cygdrive/c/Program Files/Microsoft/Web Platform Installer:/cygdrive/c/Program Files/7-Zip:/cygdrive/d/sysinternals:/cygdrive/d/batch:/cygdrive/d/Program Files/Sublime Text 2:/cygdrive/d/RailsInstaller/Ruby1.9.3/bin:/cygdrive/d/RailsInstaller/Git/cmd:/cygdrive/d/RailsInstaller/Git/bin:/usr/bin:/cygdrive/d/batch
18:54~
$ echo $PATHEXT
.RB;.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
18:54~
$ which rails
/cygdrive/d/RailsInstaller/Ruby1.9.3/bin/rails
18:54~
$ which rails.bat
/cygdrive/d/RailsInstaller/Ruby1.9.3/bin/rails.bat
18:55~
$ rails -v
D:\RailsInstaller\Ruby1.9.3\bin\ruby.exe: No such file or directory -- /cygdrive/d/RailsInstaller/Ruby1.9.3/bin/rails (LoadError)
18:55~
$ rails.bat -v
Rails 3.2.11
18:55~
$
It looks like you're using the Railsinstaller ruby binary, which is basically a redistribution of RubyInstaller with some of the essentials for Rails development bundled.
However, everything is actually working as intended.
Cygwin doesn't won't use PATHTEXT because it doesn't need to. In other words, it will call the rails binstub instead of the rails.bat batch file. Since there is a hashbang in the binstubs, cygwin handles the entire execution itself.
Also, the RubyInstaller distribution wasn't compiled for Cygwin. So ruby.exe doesn't understand the look-up of the Cygwin paths. That is why you're getting a LoadError.
In my opinion, you should probably check out this answer by Luis Lavena to a similar question. However, if you really want to, you can recompile Ruby in Cygwin or get a Cygwin Ruby distribution.
(In Windows using RailsInstaller) The only way for me was to do add and alias to the installation path.
alias rails='C:/RailsInstaller/Ruby1.9.3/bin/rails'
Once I typed that within cygwin terminal, it worked just fine.

Rails: Why "sudo" command is not recognized?

In my application directory (on Windows) I run:
sudo pdfkit --install-wkhtmltopdf
as explained here, but I got this error:
'sudo' is not recognized as an internal or external command,
operable program or batch file.
What could be the problem ?
Sudo is a Unix specific command designed to allow a user to carry out administrative tasks with the appropriate permissions.
Windows does not have (need?) this.
Run the command with the sudo removed from the start.
sudo is a Unix/Linux command. It's not available in Windows.
sudo is used for Linux. It looks like you are running this in Windows.
That you are running Windows. Read:
http://en.wikipedia.org/wiki/Sudo
It basically allows you to execute an application with elevated privileges. If you want to achieve a similar effect under Windows, open an administrative prompt and execute your command from there. Under Vista, this is easily done by opening the shortcut while holding Ctrl+Shift at the same time.
That being said, it might very well be possible that your account already has sufficient privileges, depending on how your OS is setup, and the Windows version used.
sudo is a command for Linux so it cant be used in windows so you will get that error
Sudo is a Unix specific command designed to allow a user to carry out administrative tasks with the appropriate permissions.
Windows doesn't not have (need?) this.
Yes, windows don't have sudo on its terminal. Try using pip instead.
Install pip using the steps here.
type pip install [package name] on the terminal. In this case, it may be pdfkit or wkhtmltopdf.
Analogue to sudo in Windows is running command prompt "As Administrator" by right-clicking on it's link. Then everything you run in it will be "sudo-ed".
sudo is not for windows, its for unix/linux.
option 1: install ubuntu cli software (not OS) in windows, here is the windows store link: https://www.microsoft.com/en-in/p/ubuntu-2004/9n6svws3rx71. After installing you can use ubuntu's cli in your windows where sudo will work.
option 2: install and use gem (ruby on rails) for installing wkhtmltopdf-binary
gem install pdfkit
gem install wkhtmltopdf-binary
ref: https://github.com/pdfkit/pdfkit
option 3: you can use npm or python for wkhtmltopdf insted of ruby on rails, both modules (nodeJS python) works fluently and compatible with windows:-
https://www.npmjs.com/package/wkhtmltopdf
https://pypi.org/project/wkhtmltopdf/

Resources