Help us understand the problem. What is going on with this article?

「windows」で「PowerShell」を「一切画面表示せず」に「タスクスケジューラに登録」する方法を再確認

More than 3 years have passed since last update.

何も考えずにタスクスケジューラでpowerShellを登録すると、一瞬ウィンドウが表示されるダサい事になっちゃうんだよね。-windowstyle hidden を付けても意味なし。

意味が無い
ダメな例。

じゃあどうするんかってーと、powershell.exeを使う限りどうしようもないので他の言語に頼る事になるってのが常套手段。このブログとか。
PowerShellの盲点 バイクと癒しのおじさんブログ/ウェブリブログ

具体的に以下のjsファイルを作る

task-scheduler.js
wsShell = WScript.createObject("WScript.Shell");
retCode = wsShell.Run("\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" -File \"" + WScript.Arguments.Item(0)+"\"",0,true);
WScript.Quit(retCode);

タスクスケジューラにはこう登録する。カレントディレクトリもちゃんと反映される。
imgTemp-2016-05-01-10-36-18.png

これでオッケー と。

Fushihara
javascript,nodejs,C#,powerShell,JAVA,php,js,html
https://twitter.com/Fushihara
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした