読むRedirection:
command > filename Redirect command output to a file
command >> filename APPEND into a file
>>
を使用できます。次の構文を参照してください:
wmic product get description,name,version /format:csv >>/softwarelist.csv
wmic/APPEND /?:<filename>
は、次の例を参照して、相対パスを受け入れないように見えるが
APPEND - Specifies the mode for output redirection.
USAGE:
/APPEND:<outputspec>
NOTE: <outputspec> ::= (STDOUT | CLIPBOARD | <filename>)
STDOUT - Output will be redirected to the STDOUT.
CLIPBOARD - Output will be copied on to CLIPBOARD.
<filename> - Output will be appended to the specified file.
NOTE: Enclose the switch value in double quotes, if the value contains special
characters like '-' or '/'.
wmic /APPEND
も同様に動作するはずです。 dir /B "\softwarelist.csv"
は、上記のコードスニペットの作品にそれ以降のwmic /APPEND
を保証していること
==> dir /B "\softwarelist.csv"
File Not Found
==> >NUL wmic /APPEND:"\softwarelist.csv" product get description,name,version /format:csv
Invalid file name.
==> >NUL wmic /APPEND:"D:\softwarelist.csv" product get description,name,version /format:csv
==> dir "\softwarelist.csv" | findstr "softwarelist.csv$"
27.08.2016 19:47 48 644 softwarelist.csv
注:裸のファイル名または完全修飾ファイル・パスのいずれかを使用します。
また、システムドライブのルートディレクトリが保護されています(ビスタ回以降?)、アクセスが拒否されましたメッセージを参照してください。
==> pushd c:
==> wmic product get description,name,version /format:csv >/softwarelist.csv
Access is denied.
を