SOLVED

Can not run commands within command line, PowerShell or other terminals

Copper Contributor

Issue: when I run commands in any terminal (Powershell, command prompt, VSCode terminal, etc.)

doesn't execute.
What is supposed to happen: Run a command, for example, "help", and return the default help message

What happens: Executing "help", returns the error (Powershell) "

more.com : The term 'more.com' 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:9 char:19
+ } else { $input | more.com }
+ ~~~~~~~~
+ CategoryInfo : ObjectNotFound: (more.com:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

"

Screenshot 2024-01-01 142106.png

11 Replies
Do you have c:\windows\system32\more.com on your system? But you have this issue with, for example, "get-childitem c:\" too?

@Harm_Veenstra, I can run certain commands such as "cd", "dir", and "get-childitem c:\", however, most of the useful commands, such as ipconfig are nonfunctional and return a similar error when executed, I do get around this this however by creating a .bat file that changes the dir to C:\Windows\System32 where the commands are stored.

One of the possible causes is that there is an issue with system variables, as in the past, I could not run the "jar", but the solution for me was that the PATH was not properly defined but I highly doubt that this could be the root of the issue.

If creating a bat file that changes your directory to system32, I think you might check the system path settings on your system. Compare it to another system or from Windows Sandbox if you use it

Haven't got around to doing it.

best response confirmed by Theo_suarez (Copper Contributor)
Solution

@Harm_Veenstra I've Solved it, as it was missing the following Paths in "Paths" In system variables:

%SystemRoot%\system32
%SystemRoot%
%SystemRoot%\System32\Wbem
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\
%SYSTEMROOT%\System32\OpenSSH\

 It did not contain the paths, so they could not execute the commands, thank you for suggesting that the issue could have arisen from environment variables

 

 Correct:
Correct "path"Correct "path"

Incorrect:
Incorrect "path"Incorrect "path"

@Theo_suarez Ah, nice to hear! Glad it's fixed :)



Please click Mark as Best Response & Like if my post helped you to solve your issue.
This will help others to find the correct solution easily. It also closes the item.

If one of the posts was helpful in other ways, please consider giving it a Like.

"help" is actually a function that calls Get-Help and pipes the output to more.
Use the full command Get-Help and it will not require having the more executable in your path or on your system.

Uninstall reinstall then sfc /scannow then  takeown /f *  netuser (setup) then chkdsk  if still no then try roll back of update  and or feature @Theo_suarez 

powershell in visual from cmdline admin powershell.exe and .code,,,,,,,,,,enter

 @Theo_suarez 

The problem is already fixed after adding the paths
1 best response

Accepted Solutions
best response confirmed by Theo_suarez (Copper Contributor)
Solution

@Harm_Veenstra I've Solved it, as it was missing the following Paths in "Paths" In system variables:

%SystemRoot%\system32
%SystemRoot%
%SystemRoot%\System32\Wbem
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\
%SYSTEMROOT%\System32\OpenSSH\

 It did not contain the paths, so they could not execute the commands, thank you for suggesting that the issue could have arisen from environment variables

 

 Correct:
Correct "path"Correct "path"

Incorrect:
Incorrect "path"Incorrect "path"

View solution in original post