-2

I've been using Linux for developing for at least 7 years, but in my new job I have to work with windows and I'll have to learn about it, so I decided to start learning some window's shell.

I'm quite comfortable with bash and I'd like to know what is the best way to move from bash to any window's shell and which shell choices that I have?

Keep in mind that I'll have to work with a lot of different servers (all windows) and maybe I will not have all permissions to install software as cygwin, so I think that my best choices would be using native solutions available in windows servers.

  1. What are the pros and cons about CMD and powershell? Is there any other option?
  2. Is there any good tutorial or reference that I've could learn?
  3. What is your experience in this scenario?
Jason Aller
  • 3,541
  • 28
  • 38
  • 38
charles.fg
  • 530
  • 4
  • 14
  • 1
    I just know `cygwin` and it works fine. – fedorqui Mar 07 '14 at 15:33
  • 3
    Relevant answer from PowerShell's architect: http://stackoverflow.com/a/573861/775544 – Anthony Neace Mar 07 '14 at 15:34
  • There is a [`bash` port for Windows](http://win-bash.sourceforge.net/). It is only a single executable and thus wouldn't need special permissions to install. – TypeIA Mar 07 '14 at 15:36
  • 3
    You will face cmd sometimes, but I suggest you to focus on powershell. It's quite different from other shells mainly because it uses objects. Through powershell you could access WMI and also use any .NET object, so it's very powerful once you get confident – Naigel Mar 07 '14 at 15:36
  • Read about [Cygwin](http://www.cygwin.com/) or [MSYS](http://www.mingw.org/wiki/MSYS). – Some programmer dude Mar 07 '14 at 15:37
  • PowerShell is great, and it's way more powerful than bash IMO. It has a fairly steep learning curve though, but once you learn it, it is pretty easy to use. Hopefully you will never have to use cmd.exe in your life. May it rot in hell. I think they will close your question soon because the answers will be opinion based. – dan-gph Mar 07 '14 at 15:41
  • I'd guess you'll do best with powershell – problemPotato Mar 07 '14 at 15:45
  • 1
    And if you would like an improved line editing experience in PowerShell.exe, one that support emacs keybindings, check out the PSReadline module on github https://github.com/lzybkr/PSReadLine – Keith Hill Mar 07 '14 at 17:14
  • @charles.fg : On Windows, I'm always using Cygwin (with zsh instead of bash, but bash works too, it just is a bit old (4.4.12)). Some people seem to like GitBash. Some co-workers are very fond of powershell, but this is a completely different architecture and you will have to "unlearn" and relearn a lot of habits, when switching to it. – user1934428 Aug 18 '20 at 04:48

1 Answers1

2

What Hyper Anthony said: https://stackoverflow.com/a/573861/775544

-- What are the pros and cons about CMD and powershell ?

PROs:

o Microsoft provides cmdlet modules for many of their Tier-1 products so that you can manage them directory from Powershell (e.g.: Windows Server, AD, SQL Server).

o Powershell can utilize many .Net functions (if not all of them, but some require tricky delegation code) giving you access to everything on the server.

o Powershell works natively with COM, WMI, ADSI, the Registry, the cert store, etc. (1)

o Object-oriented

o Multi-tasking/mutli-threaded jobs. The new workflow capabilities allow complex workflows to be (relatively) easily encoded.

CONs:

o CMD shell. Once you start using the Powershell, you may never need the CMD shell (the only times I use CMD is when I know a command that works in CMD but not in Powershell and I'm too lazy to find the Powershell variant).

o CMD can't do multithreaded.

-- Is there any other option?

As others have mentioned, cygwin. I used cygwin for about a year when I switched from Solaris admin to Windows. Eventually I had to migrate to CMD just because there were some instances where cygwin wasn't mature enough to handle some tasks (I don't recall what those were).

-- Is there any good tutorial or reference that I could learn?

Tons! I typically search for code samples on internet and learn from those. I also follow the Scripting Guy blog http://blogs.technet.com/b/heyscriptingguy/.

What is your experience in this scenario?

I was a Solaris admin that scripted in Bourne shell and moved to Windows admins in the Time-Before-Powershell. I used hybrid cygwin/cmd shell for a while then moved on to VBScript/WMI until Powershell v2 came out. I have a background in SW development so I really took to Powershell's OOD.

I typically home-brew my own cmdlet modules rather than download from the web, but there are a lot of well-written cmdlet modules on the web that you can utilize.

(1) From Jeffery Snover's article at Is PowerShell ready to replace my Cygwin shell on Windows?

Community
  • 1
  • 1
Arluin
  • 594
  • 1
  • 8
  • 21