cURL command failure - command-line

I am attempting to use curl commands in a batch file I am writing. I have downloaded the latest curl executable and run it but I cannot use the command "curl" What steps should I take to use it correctly? The Command line still says
"curl is not recognized as an internal or external command, able program or batch file"
I am not interested in doing anything else with cURL

You will have to add the directory containing curl.exe to your path, probably the bin directory.
In Windows XP you can do this by:
Right click your computer and choose properties
Click the advanced tab
Click environmental variables
Find path in the list and add the path to your curl directory

Steps to install curl in windows
Install cURL on Windows
There are 4 steps to follow to get cURL installed on Windows.
Step 1 and Step 2 is to install SSL library.
Step 3 is to install cURL.
Step 4 is to install a recent certificate
Step One: Install Visual C++ 2008 Redistributables
Download Visual C++ 2008 Redistributables.
Step Two: Install Win(32/64) OpenSSL v1.0.0k Light
Also from http://www.shininglightpro.com/products/Win32OpenSSL.html
For 64bit systems
Win64 OpenSSL v1.0.0k Light
For 32bit systems
Win32 OpenSSL v1.0.0k Light
Step Three: Install cURL
Depending on if your system is 32 or 64 bit, download the corresponding** curl.exe.**
For example, go to the Win64 - Generic section and download the Win64 binary with SSL support (the one where SSL is not crossed out).
Visit http://curl.haxx.se/download.html
More specific Link: http://curl.haxx.se/latest.cgi?curl=win64-ssl-sspi
Copy curl.exe to C:\Windows\System32
Step Four: Install Recent Certificates
Do not skip this step.
Download a recent copy of valid CERT files from http://curl.haxx.se/ca/cacert.pem
Copy it to the same folder as you placed curl.exe (C:\Windows\System32) and rename it as curl-ca-bundle.crt
If you have already installed curl or after doing the above steps, add the directory where it's installed to the windows path:
1 - From the Desktop, right-click My Computer and click Properties.
2 - Click Advanced System Settings .
3 - In the System Properties window click the Environment Variables button.
4 - Select Path and click Edit.
5 - Append ;c:\path to curl directory at the end.
5 - Click OK.
6 - Close and re-open the command prompt

Looks like its not on your path - try opening a new console window.

You need to add it to the path environment variable. If you want to do it through batch then you can update the reg key it stores the directories in with curl.exe like this:
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v Path /t REG_EXPAND_SZ /d "curlpath\curl.exe";%path%" /f
Or if the exe isn't dependent on any other files you could copy it to of paths existing directories like C:\Windows\system32.
Hope this helps!

Related

How to install fly cli in windows 10

I'm a newbie to concourse and it needs fly cli. I'm on windows 10 pro 64 bit.
Upon opening the fly.exe I downloaded from https://concourse-ci.org/ nothing happens.
Any idea?
Thank you!
fly is a command line tool.
Follow these steps to install it in Windows,
Download the zip file for windows from concourse-ci.org
Extract the zip file to a folder (say, C:\concourse\). The executable fly.exe is now available under C:\concourse\fly.exe
Update the PATH environment variable with this new directory C:\concourse\
Open command prompt and run fly.exe.

ionic install fails on fsevents on Windows

I have tried to install ionic on Windows but installation has failed. What should I do?
I have tried more than 20 times but still I got the same problem.
Here I have attached the screenshot for this
Entered commands:
npm install -g cordova
npm install -g ionic
Note: this one windows server machine
My guess is that the NPM global path has not been added to your windows path.
These are the steps to try:
First verify that the command just installed can run. The output contains the full path to the command installed, just copy and paste it to the command line. In your case it might be something like this %APPDATA%\Roaming\npm\iconic -v
Lets assume that works. That means that the command was successfully installed and will run, now we need to add it to your PATH so you can run it from the command line.
Next, Press Windows key and type "path" and select "Edit environment variables for your account". From here. Add or append the path %APPDATA%\Roaming\npm to your PATH variable, and save the results.
Once it is on your PATH you can run it from any command shell window.
Next, start a new command shell (e.g., Windows+R, cmd, Enter) and then type the command iconic -v. Viola, it should work without requiring the full path to the script.
I'm doing most of this from memory so hopefully it's correct. But if it needs some tweeks, let me know and I'll update the answer.
For completness, this install didn't actually fail. The lines with fsevents are warnings. The fsevents package is only designed to work on Mac Unix so these warnings can be safely ignored.
As Suraj Rao mentioned, also see Nodejs cannot find installed module on Windows?.

Ubuntu on Windows as VS Code terminal - executable path

There is a related question but it details the approach for WSL, in newer versions of Windows, the Linux distributions are not beta anymore and they are provided through the MS app store.
Where do I find the path to Ubuntu on Windows executable? (Not WSL.) I tried right-clicking on the icon to find Properties, but it is not there, it seems to be some special kind of a shortcut.
If you have multiple distros installed, you can read this how to launch one individually.
https://msdn.microsoft.com/en-us/commandline/wsl/wsl-config
However if you only have 1 installed, it will pick that one by default
There are three ways to launch and run WSL:
wsl.exe or bash.exe
wsl -c [command] or bash -c [command]
[distro] ie ubuntu -- this is the same as launching the installed app from the Windows menu.
In the first two cases, WSL must pick a distribution to run - a default distribution. If you don't explicitly set a default, it will be the first one installed.
So you can continue to simply use bash.exe
Open VSCode Settings Ctrl + , or File > Prefrences > Settings
User Settings will open up. Add the following in that file:
"terminal.integrated.shell.windows": "C:\Windows\System32\bash.exe"
Save and close the user settings file.
Enjoy bash in VSCode!

How to install nano using GitBash in Windows 10?

I am trying to install nano editor. From all the previous posts, I am stuck on path. What is path? How do I fix put my path?
I have:
$ mv nano ~/path/to/git/share
$ nano abc
bash: nano: command not found
You can add it via chocolatey.
choco install nano
PATH is the environment variable which is used to locate an executable you want to run.
See "How to permanently set $PATH on Linux?": you can add the folder where nano is in your .bashrc (which you can create directly under %USERPROFILE%, used by Git bash as $HOME)
Add to ~/.bashrc:
export PATH=$PATH:~/path/to/git/share
Then type
source ~/.bashrc
If you don't want to add it to your PATH, you can follow this step-by-step procedure, which does include the installation of nano-git-0d9a7347243.exe.
If your ultimate goal is to have and use nano on Windows 10, you can download the nano installer from here and just install the .msi file the usual Windows way. No manual path configurations required.

How to call VS Code Editor from terminal / command line

The question says it all.
How can I open VS Code editor from
windows cmd
linux and mac terminal
e.g. for notepad++ I write
> start notepad++ test.txt
By the way, the editor is awesome (cross-platform)! Thank you Nadella!
You can download it from microsoft
To open a file or directory use the command:
code /path/to/file/or/directory/you/want/to/open
For macOS users, it needs to be installed manually:
Launch VS Code.
Command + Shift + P to open the Command Palette.
Type shell command, to find the Shell Command: Install 'code' command in PATH and select to install it.
Restart your terminal.
Per the docs:
Mac OS X
Download Visual Studio Code for Mac OS X.
Double-click on VSCode-osx.zip to expand the contents.
Drag Visual Studio Code.app to the Applications folder, making it available in the Launchpad.
Add VS Code to your Dock by right-clicking on the icon and choosing Options, Keep in Dock.
Tip: If you want to run VS Code from the terminal, append the following to your ~/.bash_profile file (~/.zshrc in case you use zsh).
code () { VSCODE_CWD="$PWD" open -n -b "com.microsoft.VSCode" --args $* ;}
Now, you can simply type code . in any folder to start editing files
in that folder.
Tip: You can also add it to VS Code Insiders build by changing "com.microsoft.VSCodeInsiders". Also if you don't to type the whole word code, just change it to c.
Linux
Download Visual Studio Code for Linux.
Make a new folder and extract VSCode-linux-x64.zip inside that folder.
Double click on Code to run Visual Studio Code.
Tip: If you want to run VS Code from the terminal, create the following link substituting /path/to/vscode/Code with the absolute
path to the Code executable
sudo ln -s /path/to/vscode/Code /usr/local/bin/code
Now, you can simply type code . in any folder to start editing files
in that folder.
VS Code is a must have code editor for 2018
For Windows 10 users a lot is possible, the same way the Mac OS users type code . .
Look for you VS Code \bin folder path e.g C:\Program Files\Microsoft VS Code\bin . The bin folder includes a file called code.cmd .
If you are not sure about what is your path, type where code.cmd, and then, copy it without the \code.cmd after the ...\bin.
Follow the steps below and be proud of the OS you use.
Search for "Advanced System Setting" from Start.
Click on Environment Variables.
On System Variables choose "path" from Variable tab and click on Edit.
Click on New on the right side of the popup window.
Copy your path from the Explorer's breadcrumb path and paste it into the new opened path in step 4, example:- C:\Program Files\Microsoft VS Code\bin.
Click Ok on all the open windows to confirm changes and restart your cmd .
Go to your cmd and navigate to you working directory on server and type code . .
C:>cd wamp64\www\react-app> code . to open with VS Code on Windows.
Visual Studio Code also includes a command prompt (terminal) window and you can open one or more of them with:
Ctrl + ` on your keyboard.
Hope this helps some one like it did to many of us.
You can also run VS Code from the terminal by typing code after adding it to the path:
Launch VS Code.
Open the Command Palette (⇧⌘P) and type shell command to find the Shell Command: Install code command in PATH command.
Mac shell commands
Restart the terminal for the new $PATH value to take effect. You'll be able to type code . in any folder to start editing files in that folder.
For VS Code Insiders Windows users (vs code doc):
Add the directory "C:\Program Files (x86)\Microsoft VS Code Insiders\bin"
at %PATH% environmental variable.
then go to the folder that you want to open with vs code and type:
code-insders .
Sometimes setting path from VS Code command palette does not work
Instead manually add your VS Code to your path:
Run in terminal
sudo nano /etc/paths
Go to the bottom of the file, and enter the path you wish to add
Hit control-x to quit. Enter “Y” to save the modified buffer.
Restart your terminal and to test echo $PATH. You should something similar
~ echo $PATH /Users/shashank/.nvm/versions/node/v8.9.2/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Visual Studio Code.app/Contents/Resources/app/bin
Next time, you navigate to your project folder from terminal
Enter:
code .
or
code /path/to/project
Source
In the case of Linux and Mac, you want to navigate to the directory that you extracted the VSCode files using the 'cd' command. For example:
cd ~/Downloads/VSCode
Then you start the application by running..
./Code
'Code' being the name of the executable.
If you have root access on the machine, you can configure the system to allow you to start VSCode from anywhere by linking it to /usr/bin, where links to executables are often stored.
sudo ln -s /path/to/VSCode/folder/Code /usr/bin/Code
You can now launch VSCode from anywhere by typing:
Code
For command line heads you can also run
sudo ln -s "/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code" /usr/local/bin/code
this will do the exact same thing as the Shell Command: Install 'code' command in PATH command feature in VSCode.
When installing on Windows, you will be prompted to add VS Code to your PATH.
I was trying to figure out how to open files with VS Code from the command line and I already had the capability - I just forgot I had already added it. You might already have it installed - check by navigating to a folder you want to open and running the command code . to open that folder.
In linux if you use code . it will open VS Code in the folder the terminal was in.
Using code . Filename.cs it will open in folder and open said file.
For linux Debian the below can be done
$ export PATH=$PATH:/usr/share/code
Then run it
$ code
$ code file.py
$ code workingdir
Open command line and type:
cd your_folder_path
code.cmd .
or
code.cmd your_folder_path
It will open your folder in Visual Studio Code.
Make Sure, you are inside the correct folder after executing "cd your_folder_path" command.
On Windows you can add the following path to the system environment variables.
C:\Users\username\AppData\Local\Programs\Microsoft VS Code\bin
This works for Windows:
CMD> start vscode://file/o:/git/libzmq/builds/msvc/vs2017/libzmq.sln
But if the filepath has spaces, normally one would add double quotes around it, like this:
CMD> start "vscode://file/o:/git/lib zmq/builds/msvc/vs2017/libzmq.sln"
But this messes up with start, which can take a double-quoted title, so it will create a window with this name as the title and not open the project.
CMD> start "title" "vscode://file/o:/git/lib zmq/builds/msvc/vs2017/libzmq.sln"
typing "code" in dos command prompt worked for me
On Ubuntu the flatpak version seemed broken. I uninstalled it and downloaded the deb package right from Microsoft.
I use the following command to load a project quickly (in linux)
cd into the project cd /project
run command code pwd
similar steps can be used in other Os too.
In linux terminal you can just type:
$ code run
Windows:
Add code CLI path in a system environment variable.
in windows default code cli path is (username is you pc username)C:\Users\username\AppData\Local\Programs\Microsoft VS Code\bin
Then you can check it like this by taking your project folder and open new cmd and type code .
Step 1: create a .bat file with the name you want e.g vscode.bat
Step 2: Write your path to Visual Studio Code
Step 3: Save it in C:\Windows\System32 directory
**
C:
cd Users\Bino\AppData\Local\Programs\Microsoft VS Code
Code.exe**
Step 4: You can call visual studio code from any where by typing "vscode" which is the name of your bat file
This will work. This is your directory name "Directory_Name"
sudo code --user-data-dir="Directory_Name"
Other easyway to do it on mac is :go to Command Palette[ Shift ⇧+ Command (⌘)+P] and type :Shell Command: Install 'code' command in PATH
once installed: Shell command 'code' successfully installed in PATH.
Then you can use code from the terminal as well.
If you install VS CODE using snap. You will need to add /snap/bin in your PATH environment variable.
so - open your .bashrc or .zshrc
and add :/snap/bin in your PATH environment variable
reload terminal,
and than code comand will start it
A simple way is to go to your Project where you want to open it and type
code.cmd D:\PathTo\yourProject\MyProject
That's it. It will open your project in Visual Studio Code.
Delete old virtual environment and create a fresh virtual environment.
In a way I am reticent to add to the long list of answers. However, I searched this page for the word "portable" and came up empty. (And I did a full Stack Overflow search and also found nothing.) So I want to add this very specific answer for potential future searchers.
This answer is for if you installed VS Code in Portable Mode on Windows 10.
"Portable Mode" refers to what is described on the official VS Code web pages, which as of 21 January 2021 are found here: https://code.visualstudio.com. It does not mean the Visual Studio Code Portable project started/run by Gareth Flowers, or any similar project. (I am not saying anything bad about this or other projects - I have neither used nor evaluated.) If you are using one of those projects, you need to check with that project documentation/community - although this might work.
"Installing" VS Code in Portable Mode is downloading a .zip archive and extracting it locally wherever you want your VS Code "installation" to live. There is no actual installation or setup that is run, so there is no automatic adding of the code command to your PATH.
Answer
After extracting the Portable Mode VS Code files to the location of your choice, there should be a bin folder in that location. Copy the full path of that bin folder and add it to your System or User (your choice) PATH variable.
You should then be able to use the code command from PowerShell or CMD.
In linux you need to check first what is the name you your vscode binary file
When you get the binary file name check where it is by using this command :
whereis your_file_name
Go to the / (root) and go to bin and rename file with any name what you want to call it.
To rename : mv your_file_name your_changed_name
Now you can access vscode from any where in terminal
This works on Debian based Os definitely