Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

man is not working in cmd on Windows 10 #7

Closed
OskarKlintrot opened this issue Mar 10, 2016 · 14 comments
Closed

man is not working in cmd on Windows 10 #7

OskarKlintrot opened this issue Mar 10, 2016 · 14 comments

Comments

@OskarKlintrot
Copy link

When running woman on Windows 10 in Powershell or cmd I get this error:

PS C:\Users\oskar> woman ls
'man' is not recognized as an internal or external command,
operable program or batch file.

Error: Command failed: C:\WINDOWS\system32\cmd.exe /s /c "man ls | groff -mandoc -Thtml"
'man' is not recognized as an internal or external command,
operable program or batch file.

Looks like man is not working in cmd, is it possible to use Powershell instead?

@dawsbot
Copy link
Owner

dawsbot commented Mar 11, 2016

Yikes, looks like windows does not have man pages at all. What would the syntax be in you Powershell to get a basic manual of the ls command?

Thanks, I'd love for this to port over to Windows, but I don't have a Windows machine to test commands. I'd need someone like you to contribute. Warning of lack of Windows support added to the readme with commit: 25ecb67

@OskarKlintrot
Copy link
Author

It's true that man is not a "native" command in Windows. It's just an alias for Get-Help so man ls is an alias for Get-Help Get-ChildItem, which is a Powershell-only cmdlet. I didn't release that yesterday. But, man ls gives you the same man page as I remember them from Linux 10 years ago. So using Powershell it should be able to port it fairly easy to Windows. I don't think piping works in cmd (I never use it) but it work's in Powershell (I just saw some piping in the source, that's why I added that comment).

@OskarKlintrot
Copy link
Author

This is the output of man ls in Powershell in Windows:

PS C:\Users\oskar> man ls

NAME
    Get-ChildItem

SYNTAX
    Get-ChildItem [[-Path] <string[]>] [[-Filter] <string>] [-Include <string[]>] [-Exclude <string[]>] [-Recurse] [-De
    pth <uint32>] [-Force] [-Name] [-UseTransaction] [-Attributes <FlagsExpression[FileAttributes]> {ReadOnly | Hidden
    | System | Directory | Archive | Device | Normal | Temporary | SparseFile | ReparsePoint | Compressed | Offline | N
    otContentIndexed | Encrypted | IntegrityStream | NoScrubData}] [-Directory] [-File] [-Hidden] [-ReadOnly] [-System]
      [<CommonParameters>]

    Get-ChildItem [[-Filter] <string>] -LiteralPath <string[]> [-Include <string[]>] [-Exclude <string[]>] [-Recurse] [
    -Depth <uint32>] [-Force] [-Name] [-UseTransaction] [-Attributes <FlagsExpression[FileAttributes]> {ReadOnly | Hidd
    en | System | Directory | Archive | Device | Normal | Temporary | SparseFile | ReparsePoint | Compressed | Offline
    | NotContentIndexed | Encrypted | IntegrityStream | NoScrubData}] [-Directory] [-File] [-Hidden] [-ReadOnly] [-Syst
    em]  [<CommonParameters>]


ALIASES
    gci
    ls
    dir


REMARKS
    Get-Help cannot find the Help files for this cmdlet on this computer. It is displaying only partial help.
        -- To download and install Help files for the module that includes this cmdlet, use Update-Help.
        -- To view the Help topic for this cmdlet online, type: "Get-Help Get-ChildItem -Online" or
           go to http://go.microsoft.com/fwlink/?LinkID=113308.

@dawsbot
Copy link
Owner

dawsbot commented Mar 11, 2016

Oh alright, I think I know how to start on this issue. There are a few hacks in the source that should be refactored using shelljs. As you stated, it simply doesn't port over to Windows because of a few commands that should be instead put into functions and libraries like shelljs.

I'll be able to work on this next week.

@OskarKlintrot
Copy link
Author

Great! I will be happy to test it later on then!

@dawsbot
Copy link
Owner

dawsbot commented Mar 11, 2016

👍

@BenSeddikMehdi
Copy link

Hi, I have such a problem that seems like that, when I am using the command 'man' in my C program:

**'man' is not recognized as an internal or external command,
operable program or batch file.
**

Have you an idea about what's going on?

@dawsbot
Copy link
Owner

dawsbot commented Nov 30, 2019

@BenSeddikMehdi Let's try to figure this out by looking at your computer's setup.

  1. What OS are you using?
  2. What do you get from executing which man?
  3. What's the exact woman _ command you're using when you see this error?

@BenSeddikMehdi
Copy link

Thank you, Mr. @dawsbot,

  1. My OS: Windows 10, and I am using Clion Editor (JetBrains) to run C Code.
  2. After typing the command man here is what I got: D:\MATLAB_Drive\2019_10_18_CNC_Problems\CNC_2011>man
    'man' is not recognized as an internal or external command,
    operable program or batch file.

@dawsbot
Copy link
Owner

dawsbot commented Dec 7, 2019

Hey @BenSeddikMehdi, I would love for this project to function properly on Windows, but I'm not best suited for working on that. Would you be open to testing and making changes for it to work on Windows?

The script is just 62 lines total, and is well commented. You can ask me any questions you might have! Cheers 🙌

@BenSeddikMehdi
Copy link

I did install Cygwin http://cygwin.com/ and I resolved the problem after adding it to the path in windows 10.

@dawsbot
Copy link
Owner

dawsbot commented Dec 12, 2019

@BenSeddikMehdi is it worth documenting how you added it to the windows path?

It looks like @OskarKlintrot had an issue with Windows as well which your fix might help for 🙌

@OskarKlintrot
Copy link
Author

I guess it might work but I really don't want to install Cygwin and adding it to the path because of a) I don't want to pollute my computer more than necessary and b) I write ps-scripts for CI/CD-pipelines and then I most definitely don't want to have stuff locally that I don't have on my build-agents. I try to avoid using aliases in those scripts but old habits die hard :)

About adding cygwin to the path, IMHO it is not really worth documenting. If you end up trying to install Woman you most likely knows how to add stuff to your path. If not there is tons of information just a google away. For fun I tried to google windows 10 add to path and the first suggestions were very good and easy to follow even for less experienced 👍

@dawsbot
Copy link
Owner

dawsbot commented Dec 12, 2019

Thanks for the tips @OskarKlintrot, I'm so out of my element with Windows hearing this is very helpful.

I documented this process in the readme https://github.com/dawsbot/woman/blob/master/README.md#windows-users

Please open a PR to improve the documentation if there is anything left out 🙌

@dawsbot dawsbot closed this as completed Dec 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants