user1444474
user1444474

Reputation: 1

Using .bat to launch a powershell script

I can execute the following script in powershell successfully but when i try to run the script from a .bat i am unsucessful.Is there a certain way that the .bat file calls the powershell script as it keeps failing. How would i create a .bat script to run the powershell script below.

cd 'Program Files (x86)\Citrix \XenApp \ServerConfig' .\XenAppConfigConsole.exe /ExecutionMode:Join /FarmName:xencity /OdbcUsername:chris /odbcPassword:Jahner0 /DsnFile:"C:\xencitylifeSQLDS.dsn"

Please help guys Many thanks

Upvotes: 0

Views: 1442

Answers (1)

Bali C
Bali C

Reputation: 31221

You can do this by putting powershell at the start of the command

powershell cd 'Program Files (x86)\Citrix \XenApp \ServerConfig' .\XenAppConfigConsole.exe /ExecutionMode:Join /FarmName:xencity /OdbcUsername:chris /odbcPassword:Jahner0 /DsnFile:"C:\xencitylifeSQLDS.dsn"

That just calls up powershell and gives it your command to run, except your running it in cmd.

Upvotes: 1

Related Questions