0

I have a Powershell script which converts a CSV file to Excel, however I want to create a Batch file to execute that Powershell script. When I try to I get an error message:

error processing aurguments. there is no option with the following name: execution policy.
Syntax
powershell_ise.exe[[-File] <listoffiles>][-Help]-[MTA][-Noprofile]

The Batch file script is:

@echo off
Powershell_ise.exe -executionpolicy remotesigned -File  C:\Users\siddhary\Desktop\csv_to_xlsx .ps1

however when I open the Powershell_ise.exe, then open the script from desktop & run, it runs succesfully. But when I try to do it with a batch file I get the above error message. Please help.

Kohlbrr
  • 3,861
  • 1
  • 21
  • 24
  • 1
    The error seems pretty self-explanatory. That option isn't supported. http://technet.microsoft.com/library/hh847883 – Dark Falcon Mar 27 '14 at 14:08

2 Answers2

1

The error message is telling you exactly what's wrong. Powershell_ise.exe does not accept an -executionpolicy parameter. You can verify this yourself by running:

powershell_ise.exe /?
mjolinor
  • 66,130
  • 7
  • 114
  • 135
0

Change your call from powershell_ise.exe to powershell.exe

@echo off
Powershell.exe -executionpolicy remotesigned -File  C:\Users\siddhary\Desktop\csv_to_xlsx .ps1

Here's the reference to using powershell_ise.exe, and here's powershell.exe

ShaneC
  • 2,237
  • 2
  • 32
  • 53