What tools and languages โ€‹โ€‹are available for Windows shell scripts?

I want to know what are some of the scenarios for running on a Windows platform. I need functionality like file manipulation, registry editing, etc. Can files be edited using scripting tools? What other features do Windows scripting tools provide? Is it possible to do everything that can be done using the Windows GUI using a scripting language?

+3
windows scripting
source share
12 answers

I think Microsoft's Windows PowerShell is the current favorite for this kind of thing.

+5
source share

It might be worth taking a look at the preview version of version 2.0. A lot of things have changed:

http://blogs.msdn.com/powershell/archive/2007/11/06/what-s-new-in-ctp-of-powershell-2-0.aspx

+1
source share

How about installing a version of Windows Python , Perl, or your favorite language? They should offer all the necessary features.

+1
source share

Batch files are the most portable, but complex things can get complicated (very complicated).

Powershell is incredibly efficient, but the installed domain is currently only slightly larger than those people who like to use powershell and the servers they manage. If you control the machines on which you are running the scripts and can indicate that PowerShell is installed, PowerShell is the way to go. Otherwise, batch files are the best way.

Powershell allows you to do everything you can do, but some things will be harder than others :)

(Seriously, if you want to control a Windows graphical application from a script, you will have a lot of pain if the application does not support scripts on your own, or you want to start posting messages to dialog controls and a screen scraping dialog to verify success.)

+1
source share

I would recommend Take Command ( JPSoft ), which is more like cmd.exe than PowerShell. We have been using here at ESSS for many years.

+1
source share
0
source share

CScript? I remember seeing something like that.

0
source share

Powershell is good, but this is an extra thing you need to install. Non-standard for almost any Windows installation. So, if this is just for your own use, then powershell should be fine. If you need scripts for working on computers of the general population, for example, as part of a piece of software that you produce, this may not be the best option.

If everything is in order, you need to install an additional game, you can check cygwin. This allows you to have the full Linux bash command line and all related tools at your disposal.

If you need something included in the default Windows installation. There is a windows command line (cmd.exe). Which has some functionality, but very little compared to what is available on Linux. Another, probably the worst, problem is that there is not much documentation about it.

You may also be interested in VB Script (flame away). VB Script should work with almost any of the latest standard Windows installations and much more functional than the command line.

0
source share

I have cygwin installed, so I can run bash shell scripts for my automation tasks. In addition, when I need Windows to work tirelessly, I use a combination of batch + jscript (it runs in cmdline, if you have Visual Studio.Net installed, just call it "cscript XXX.js").

0
source share

Scripting is an explosion.

Personally, I like to write some kind of evil little batch files. You can find a command line program to do anything. I prefer batch files mainly because they are transferred from one machine to another, and no more than zip with several unix tools (SSED, GREP, GAWK). There is a REG.Exe command line that can even make registry changes and read. You can analyze the output from commands using the "FOR / f" loop.

PowerShell has more ... err .. Power (2nd post I wrote this, but I can not help.)

If you want to see window automation, check out AutoHotKey .

What are you trying to automate? This can help us narrow down what would be helpful.

  • Josh

EDIT: for the record, I typed this at the same time as @jameso. If someone at work did not ask me a question, I might have placed it in front of him. I got a little shiver at the similarity of the message though ....

0
source share

Powershell can do what you need.

file manipulation

This SO post explains how you can replace a string in your text file. Paste it here for convenience

(Get-Content c:\temp\test.txt).replace('[MYID]', 'MyValue') | Set-Content c:\temp\test.txt

There are other things you can do, such as copying files and folders. You can learn more about the Windows Powershell documentation.

registry editing

This is easy to do with Powershell. Here is sample code from Microsoft Dev Blogs :

Set-ItemProperty -Path HKCU:\Software\hsg -Name newproperty -Value anewvalue

0
source share

Yesterday I could repair it for you;)

What are all the tools / languages โ€‹โ€‹for windows shell scripts?

It will be better to read how

What tools and languages โ€‹โ€‹are available for Windows shell scripts?

-one
source share

All Articles