質問

私は少し興味深い要件を持っています。私のクライアントは、JavaアプリケーションからSharePoint 2010管理UIを開発したいです。だから私は彼がユーザーSharePoint Webサービスに勧めます。私たち全員が使い方を知っているように。しかし彼はこれを命令に基づいて実行したいです。だから私はPowerShellコマンドレットを持つバッチファイルをユーザーに勧めます。私はこのアーキテクチャによくわからない。しかし、誰かが私を集中させることができます、バットファイルを使ってPower Shellコマンド(コマンドレット)を使う方法は?

役に立ちましたか?

解決

You can execute them like any other script which you schedule in your servers Task Scheduler (if that is what you want to do on a regular basis). First, build your powershell script as you usually do and place the file in an appropriate folder. Then build your bat-file calling the powershell script - like this:

powershell .\test.ps1 arg1

You can have multiple argument while calling the script as long as you handle them in your script.

If you need to write .bat-files using powershell, you can use the Out-File command, well described in the article Using the Out-File Cmdlet. Like the following:

Get-Process | Out-File c:\scripts\test.txt

More to read: Use bat to start Powershell script

ライセンス: CC-BY-SA帰属
所属していません sharepoint.stackexchange
scroll top