LoginSignup
1
0

More than 5 years have passed since last update.

winコマンドでの文字化けを防止するラッパー

Last updated at Posted at 2018-12-18

winコマンドと同名のラッパースクリプトを作る。中身はどれも同じ。
winコマンドと同じ要領で実行する。

ping
#!/bin/sh
$(basename $0).exe $@ 2>&1 | iconv -f CP932 -t UTF-8
ipconfig
#!/bin/sh
$(basename $0).exe $@ 2>&1 | iconv -f CP932 -t UTF-8
arp
#!/bin/sh
$(basename $0).exe $@ 2>&1 | iconv -f CP932 -t UTF-8

対話モードのあるものはwinptyが必要。ただしパイプでつなげなくなる。

#!/bin/sh
winpty $(basename $0).exe

参考記事:http://takuya-1st.hatenablog.jp/entry/20110811/1313045543

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0