Question

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?
Was it helpful?

Solution

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?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top