Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
Help us understand the problem. What is going on with this article?

【Windows】バッチファイルで文字列操作

More than 5 years have passed since last update.

部分文字列

文字列の5番目から2文字を抽出。(一文字目が0番目)

C:\>set V=ABCDEFGHIJKL
C:\>echo %V:~5,2%
FG

置換

文字列 "/" を " "(空白) に置換する

C:\>set dt=%date%
C:\>set dt
dt=2011/08/24
C:\>echo %dt:/= %
2011 08 24

参考サイト

http://www.atmarkit.co.jp/ait/articles/0405/01/news002.html

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