How do you fix "google-chrome" is not recognized in VS Code? - visual-studio-code

I'm trying to run HTML for the first time in VS code, but when I run it, it says
"google-chrome" is not recognized as an internal or external
command,operable program or batch file.
A screenshot of my problem has been attached below.
How can this be fixed?

You have to save that file with the name that browser can recognize, it should look something like 'filename.html'. Then you can open it with a web server application like xampp, or just open it on your file explorer.

The issue is that google-chrome is not a recognized command in Windows (it is in Linux distros).
The easiest way to make it work is saving the ".html" file with a proper name (something.html) and then use the command cd "C:\Users\LGU BATO\Desktop\html\" && something.html.
An explanation of this command is:
First, it will cd into the directory, as listed on the screenshot. This changes the directory of the command prompt window.
It will then open the file with your default browser.

Related

TCL/TK Wish can't find file in the same directory

I am trying to write a TCL/TK Script that accesses an INI File with the command [::ini::open DBW.ini]. I am using the inifile package for this and am trying to run on wish for the gui.
However, wish answers with "couldn't open "DBW.ini": no such file or directory". The odd thing about this is, that I can run this Code in the VSCode extension "Code Runner".
Code Runner is configured to access the same wish Compiler that I'm trying to run on my Windows System.
Why would I be able to run this Code through VSCode, but when im using the wish Compiler directly it throws an error message.
Thank you in advance
Most likely your Tcl code is not being executed in the same directory as where the DBW.ini file is. The Tcl command pwd will return the directory where the code is executing. If this is not where the ini file is, a simple fix would be to specify the whole path to the file when you try to open it, something like:
[::ini::open C:/some/where/DBW.ini]

How to NOT open Visual Studio Code from the command line

I see a lot of posts asking how to open VScode from the command line; I have the opposite problem!
When a type a file name from the CMD terminal, VSCode is launched with the file contents...why is that? I don't want that to happen! Any ideas on how to stop this from happening?
Maybe you should check your environment variables and find path for VScode, then delete it
Also maybe in your file properties VScode is set to default opening app , so it open files by default
For example (In my case Intellij IDEA) it looks something like this:
this mean you should go to properties and change "opens with" options
Thanks for the hints; they both helped on solving the problem.
The one particular file that I wanted to execute and NOT open with vscode is a bash script file with extension " .sh ".
I checked the file manager and it is not associated with vscode; instead, it says "SH Source File".
Then, I followed the link to thisdavej and after seeing the proposed registry entries, I went ahead and looked into my own registry...found that the .sh extension had an "OpenWithProgids/VSCode.sh", deleting that solved my problem. Now, when I type the name of the shell script, it actually executes.
Thanks.

'code' is not recognized as an internal or external command - Microsoft Visual studio Code

I am using visual studio code for develop my react application. I just wanted to open the project in the IDE using CLI, using "code ." command. Although it was perfectly working previously, now shows an error as below.
'code' is not recognized as an internal or external command,
operable program or batch file.
Can someone help me out to solve this matter?
This sounds like an issue with your environment variables rather than a problem with VS Code itself.
When you run the code command in Windows Command Prompt (cmd), Windows searches all commands on your path for one named code, and executes that command. VS Code installs a command with this name that opens the editor, normally located here on Windows:
C:\Program Files\Microsoft VS Code\bin
It may be that your path no longer contains this particular directory for some reason.
You can edit your path directly to add it:
From the Start menu, type "variables" and choose the option to "Edit environment variables for your account".
Locate the PATH entry and edit it.
Add the directory where the code command exists, e.g. C:\Program Files\Microsoft VS Code\bin.
The path editor may appear slightly different depending on what version of Windows you are running.
My case was different rather than general solution for this question. I saw that the number of solutions which says the probelm exists with the environment valriables. In the new release it provides a setup file only.
Before downloading, there are certain properties to be selected.When I just redownloaded the set up and run it , it starts working perfectly.

How to open file using vscode terminal?

I want to open a new tab and open a file using vscode terminal.
like open somefile.js command, so I can use ls and open file quickly.
Use code -r <file> to open the file in the last active code window
use
code -r <filename>
just remeber to install the code command to PATH. in VScode, open the command palette and type "code", you should see a Shell Command: Install code to PATH option.
I really haven't actually seen any difference between using the command without the -r flag.
If you are already in VSCode terminal (not an external OS terminal), check out the latest VSCode 1.64 (Jan. 2022) Terminal shell integration:
The terminal now features experimental opt-in shell integration which allows VS Code to gain insights on what is going on within the terminal as it was previously a black box.
When enabled using "terminal.integrated.enableShellIntegration": true, arguments to run a shell integration script will be injected into your terminal profile if possible.
The script itself mostly just injects invisible sequences into your prompt, providing us with information like where the prompt, command and command output is, what the current working directory (cwd) is for each command and the exit code of each command.
That means:
Link support relative to the cwd
Since we know the cwd for each line in the terminal buffer, we can support opening links in the terminal relative to the cwd at the location where it was activated.
Before, when a link was clicked, a quick pick would open with results from any folders containing a match for that name.
Now, the exact file match will be opened.
In a terminal with a cwd of VSCode, package.json is echoed.
Clicking on the file name will result in vscode/package.json opening.
The directory is changed to be the template-string-converter and then package.json is echoed.
Clicking on the file name will open template-string-converter/package.json.

PhoneGap command not recognized

I have followed the directions on PhoneGap's website and installed PhoneGap using the command prompt on Windows. However, after it has installed I try to run the command 'phonegap' and I get an error saying that 'phonegap' is not recognized as an internal or external command, operable program or batch file. How do I fix this? Thanks.
You might need to add phonegap to your classpath variable, in order to let the prompt know where the phonegap .exe file is located.
Try writing the full path of the exe file, if that runs, then what I mentioned above should solve your problem.
EDIT
Just looked at the install page at phonegap.com (http://phonegap.com/install/). Very scarce on the information I would say.. But I still recommend investigating the above.
The Problem with enthronement variable for default path of your your current user. Follow the steps.
Click the Start menu and type "regedit" on the search box. This will launch the Windows Registry Editor program.
Enter to the following Registry entry: HKEY_CURRENT_USER\Software\Microsoft\Windows Script Host\Settings
Select the "Enabled" entry in the right side window. If this entry is there, right-click and select "New" followed by "DWORD Value." Name the value "Enabled."
Right-click the "Enabled" entry and click "Modify."
Change the number in the "Value" box to "1." This will re-enable WSH.
close all opened cmd windows and open a new window.
Just try to run CMD as administrator. Hopefully that will solve your problem. This solved mine.
Even though this is a very old question, I'm going to post a solution that worked for me on Windows Vista/7/8. The problem is that by default the command prompt in which the npm command is run is not elevated. So launch a command prompt as administrator and then run npm command. If it is not elevated then the environment variables wont be set properly.
In windows 7 platform, when the latest version of phonegap (3.4) installed it hosts in path like this:
C:\Users\\AppData\Roaming\npm
Sometimes you should add this address to the PATH environment manually.
Go to System Properties-> Advanced -> Environment Variables
Select PATH variable from list and then edit it