After uninstalling Conda 3.8 cmd became unavailable - cmd

Overview
I uninstalled Conda and it broke cmd. I am unable to start cmd and I also get an error when opening a PS terminal. When I installed Conda I ran conda init for ps and cmd. I would like to reverse the effect of this command. I no longer have conda and so cannot use that.
Powershell behaviour:
conda : The term 'conda' is not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of the
name, or if a path was included, verify that the path is correct and
try again. At line:1 char:1
conda init --reverse
+ CategoryInfo : ObjectNotFound: (conda:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Cmd behaviour:
Doesn't open, brief flash of a window.

Resolution
In the registry, there is a key; HKEY_CURRENT_USER\Software\Microsoft\Command Processor\autorun with the value set to if exists. I removed that key's value. If you have a statement that runs batch scripts, don't just bin it.
What is this key?
According to this resource the key is used to run batch scripts prior to opening cmd.
Why?
if exist was evaluating to false and that blocked cmd from starting. I tested with a dummy expression if exist 1=1 which led to cmd starting.
Culprit
This happened when uninstalling Conda 3.8.

Related

How to run .sh script in Intellij in Windows

I have a problem about running sh file in Intellij in Windows.
When I clicked the run button in the file, I got this output shown below.
PS C:\Users\username\IdeaProjects\library> /bin/sh C:/Users/username/IdeaProjects/library/aws-setup.sh
/bin/sh : The term '/bin/sh' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify t
hat the path is correct and try again.
At line:1 char:1
+ /bin/sh C:/Users/username/IdeaProjects/library/aws-setup.sh
+ ~~~~~~~
+ CategoryInfo : ObjectNotFound: (/bin/sh:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
How can I fix it?
Set Settings (Preferences on macOS) | Tools | Terminal | Shell path to c:\Program Files\Git\bin\bash.exe or use Shell Script run configuration with Interpreter path set to bash.exe:

Anaconda Command Prompt Window Won't Open After Reinstallation

I have had to uninstall and then reinstall miniconda. After reinstalling, when I run, the powershell prompt shows the following message:
& : The term 'C:\Users\jenj0\anaconda3\Scripts\conda.exe' is not recognized as the name of a cmdlet, function, script
file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct
and try again.
At C:\Users\jenj0\Documents\WindowsPowerShell\profile.ps1:4 char:4
+ (& "C:\Users\jenj0\anaconda3\Scripts\conda.exe" "shell.powershell" "h ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (C:\Users\jenj0\...ripts\conda.exe:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
(base) PS C:\Users\jenj0>
Additionally, the miniconda command prompt window doesn't launch at all.
I tried looking for solutions. For example, I tried this, but when I try to launch cmd.exe, I see a quick flash of a window opening and then closing and nothing happens.
I have also tried uninstalling/reinstalling miniconda again and had the same issue. I was doing that because I was having issues to run a program. Now I am even further away from solving the problem.
There is some invalid paths in the startup scripts for powershell and also the registry keys for cmd, stemming from your previous anaconda installation.
You say that you uninstalled anaconda and then installed miniconda, so I am assuming that the path
C:\Users\jenj0\anaconda3
does not exist and is now
C:\Users\jenj0\miniconda3
Here is what you do:
Powershell (from your error message) is trying to read C:\Users\jenj0\Documents\WindowsPowerShell\profile.ps1 which contains references to the invalid path. Backup said file and then delete any lines that contain the invalid path
cmd (and anaconda prompt). Run regedit and then delete the reference to the invalid path in the keys at
Computer\HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun
Computer\HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun

Can't execute Ruby file using Powershell

I want to execute a ruby file using windows 10 powershell. In my powershell terminal, when I type
ruby test.rb
I receive
ruby: The term 'ruby' is not recognized as the name of the cmdlet, function,
script file, or operable program. Check the spelling of the name, or if a
path was included, verify that the path is correct and try again.
At line:1 char:1
+ ruby test.rb
+Category Info :ObjectNotFound: (ruby:String) [],
CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
These commands don't work either
ruby.exe test.rb
rb.exe test.rb
I'm in the right directory. I suspect the problem has to do with PATHs, but I don't understand PATHs yet. I have been trying to execute .rb files in both Powershell and my beginner IDE, Visual Studio Code.
Thanks
It is absolutely a problem with your path. Try this:
$Path = 'C:\Path\to\ruby.exe'
& $Path args
Make sure your root folder for ruby.exe is in the $env:Path variable.
$env:Path -split ';'
For me I had to kill all instances of powershell -- in my case vscode then relaunch and it picked up the new path environment variables and ruby worked!
Sometimes a full restart is what the doctor prescribed.
I've also had cases where you had to run the program as an administrator to work and have the proper updated new path variable.
In powershell, navigate to the directory where your ruby file is stored. It will look something like this C:\Users\Joe\Desktop\Ruby_Practice_folder>
Type
#!/usr/bin/env ruby
Hit enter. Type
ruby your_ruby_file.rb

While running a batch file from Windows 10 cmd I'm getting an error that a term is not recognised as cmdlet function

This is the exact error on the cmd window.
this is the command I typed to be executed in the cmd
F:\Fast R-CNN\Cognitive tool kit\cntk\Scripts\install\windows>install.bat
CNTK Binary Install Script
F:\Fast : The term 'F:\Fast' is not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of the name, or
if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ F:\Fast R-CNN\Cognitive tool kit\cntk\Scripts\install\windows\ps\inst ...
+ ~~~~~~~
+ CategoryInfo : ObjectNotFound: (F:\Fast:String) [], CommandNotF
oundException
+ FullyQualifiedErrorId : CommandNotFoundException
Error during install operation
I've tried running as admin, direct clicking, changing the path etc. Kindly tell me a way to run this file. It's a batch file for a series of installations for the Microsoft cognitive tool kit.
Looks like you need to enclose the path in quotes
"F:\Fast R-CNN\Cognitive tool kit\cntk\Scripts\install\windows\install.bat"
use "start" before the filename.
Example:
F:\Fast R-CNN\Cognitive tool kit\cntk\Scripts\install\windows>start install.bat

DNVM error: cannot find dnx-clr-win-x86.1.0.0.-rc1-final

I'm having some issues with dnvm.
The error that is displaying is this:
D:\development\Disqorse>dnvm use 1.0.0.-rc1-final
Cannot find dnx-clr-win-x86.1.0.0.-rc1-final, do you need to run 'dnvm install
1.0.0.-rc1-final'?
At C:\Users\Jonathan Smith\.dnx\bin\dnvm.ps1:1667 char:9
+ throw "Cannot find $runtimeFullName, do you need to run '$Com ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (Cannot find dnx....0.-rc1-final'?:St
ring) [], RuntimeException
+ FullyQualifiedErrorId : Cannot find dnx-clr-win-x86.1.0.0.-rc1-final, do you ne
ed to run 'dnvm install 1.0.0.-rc1-final'?
'C:\Users\Jonathan' is not recognized as an internal or external command,
operable program or batch file.
The system cannot find the path specified.
But when I run the above commands and try suggestions from SO I still get the same issue. Also interesting is the fact that after I carry out ANY commands I get the text at the bottom complaining there is a non-recognized command. I susepect this is because there is a space in the folder name which represents the current user. I can't be sure whether this is the problem or not though.
Check script execution permission level in your powershell window. I set it to remote signed using:
Set-ExecutionPolicy RemoteSigned
Also, you need to supply the runtime and architecture as well:
like dnvm use 1.0.0-rc1-update1 -r clr -arch x64
Your version of dnvm has a bug and does not work when user name contains spaces.
One of the proposed solutions is to self-update it using
dnvm update-self
And if that does not work, try using new command-line interface that replaces dnvm. You can read about it in more details here - https://github.com/aspnet/dnvm/issues/190 (bottom posts)

Resources