A coworker has sent a script file she wrote for Windows OS based systems. She said it was a PowerShell script and it has a .bat
file extension. When you run the script you receive several errors immediately. What is most likely the issue?
Run the file as administrator first
Extension should be .bat1
or .bat2
PowerShell is not compatible with Windows OS
Correct Incorrect Unanswered Report Issue Answer Description
PowerShell scripts have an extension of ps1
. .bat
extensions are for Batch scripts, not PowerShell.
Wikipedia
PowerShell is a task automation and configuration management program from Microsoft, consisting of a command-line shell and the associated scripting language. Initially a Windows component only, known as Windows PowerShell, it was made open-source and cross-platform on August 18, 2016, with the introduction of PowerShell Core. The former is built on the .NET Framework, the latter on .NET (previously .NET Core).
Since Windows 10 build 14971, PowerShell replaced Command Prompt and became the default command shell for File Explorer.In PowerShell, administrative tasks are generally performed via cmdlets (pronounced command-lets), which are specialized .NET classes implementing a particular operation. These work by accessing data in different data stores, like the file system or Windows Registry, which are made available to PowerShell via providers. Third-party developers can add cmdlets and providers to PowerShell. Cmdlets may be used by scripts, which may in turn be packaged into modules. Cmdlets work in tandem with the .NET API.
PowerShell's support for .NET Remoting, WS-Management, CIM, and SSH enables administrators to perform administrative tasks on both local and remote Windows systems. PowerShell also provides a hosting API with which the PowerShell runtime can be embedded inside other applications. These applications can then use PowerShell functionality to implement certain operations, including those exposed via the graphical interface. This capability has been used by Microsoft Exchange Server 2007 to expose its management functionality as PowerShell cmdlets and providers and implement the graphical management tools as PowerShell hosts which invoke the necessary cmdlets. Other Microsoft applications including Microsoft SQL Server 2008
PowerShell - Wikipedia, the free encyclopedia Subscribe to avoid duplicate questions and track your progress over time