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

バッチファイルを初めて少し勉強したのでメモ

More than 1 year has passed since last update.

バッチファイルを少しだけ勉強したので、メモ

test1.bat
@echo off
先頭に常に記述


set test = ryuji
変数「test」に「ryuji」という文字列を格納する


echo test
変数「test」の中身を表示する


if exist test.bat (
    mkdir ryujii1
 ) else (
    mkdir ryuji2
 )
もし、「test.bat」というファイルが存在していれば、
「ryuji1」というディレクトリを作成し、存在していなければ、「ryuji2」というディレクトリを作成する

実行方法

まず上記のファイルを作成して任意の場所に保存。
コマンドプロンプトを起動して、

cd 「ディレクトリ」

test1.bat

で実行可能。

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
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