What tools and languages are available for windows shell scripting?

后端 未结 12 1136
孤独总比滥情好
孤独总比滥情好 2021-01-21 01:28

I want to know what are the options to do some scripting jobs in windows platform. I need functionality like file manipulations, registry editing etc. Can files be edited using

相关标签:
12条回答
  • 2021-01-21 02:03

    Powershell is nice, but it's an extra thing you have to install. Not standard in almost any windows installation. So, if it's just for your own use, then powershell should be fine. If you need the scripts to run on the computers of the general population, for instance, as part of a piece of software you are producing, it may not be the best option.

    If you are ok with an extra thing you have to install, you might want to check out cygwin. This allows you to have a full Linux bash command line and all the associated tools at your disposal.

    If you need something included in a default windows install. There's the windows command line (cmd.exe). Which has some functionality, but is very deficient compared to what's available in Linux. The other, probably worse problem, is that there isn't much out there in the way of documentation.

    You might also be interested in VB Script (flame away). VB Script should work on almost any recent standard windows install, and is a lot more functional than the command line.

    0 讨论(0)
  • 2021-01-21 02:04

    Powershell can do what you need.

    file manipulations

    This SO post answers how you can replace a string in your text file. Pasting it here for easy reference:

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

    There are other things that you can do, such as copying files and folders. You can find out more on the Windows Powershell Documentation

    registry editing

    This can be easily done using Powershell. Here's a sample code from Microsoft Dev Blogs:

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

    0 讨论(0)
  • 2021-01-21 02:06

    It might be worth looking at the prerelease of version 2.0. A lot of stuff has changed:

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

    0 讨论(0)
  • 2021-01-21 02:11

    Windows Scripting Languages

    Also take a look at PowerShell

    0 讨论(0)
  • 2021-01-21 02:13

    I would recommend "Take Command" (JPSoft), which is more like "cmd.exe" than the PowerShell. We use here at ESSS for years.

    0 讨论(0)
  • 2021-01-21 02:17

    I have cygwin installed, so I can run bash shell scripts for my automatization needs. Besides, when I need stuff running moreless natively on Windows, I use a combination of batch + jscript (runs on cmdline if you have Visual Studio.Net installed, just call "cscript XXX.js").

    0 讨论(0)
提交回复
热议问题