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

バッチファイルにドラッグアンドドロップした時のファイル名の扱い方

%1でファイル名を取得
%~n1で拡張子より前のファイル名を取得
%~p1は上記の%~n1にパスを含む

例)拡張子をdatに変更するコマンド

rename %1 %~n1.dat

例)epsやpsファイルをpdfに変換するコマンド

gswin32c -dNOPAUSE -dBATCH -dEPSCrop -sDEVICE=pdfwrite -sProcessColorModel=DeviceCMYK -dPDFSETTINGS=/prepress -sOutputFile=%~p1.pdf -f %1

参考サイト】
【Windows】バッチファイルの引数 at softelメモ

複数ファイルをバッチファイルにドラッグアンドドロップの場合

@echo off
for %%f in (%*) do (
gswin32c -dNOPAUSE -dBATCH -dGraphicsAlphaBits=4 -dEPSCrop -sDEVICE=jpeg -r500 -sOutputFile=%%~pnf.jpg -f %%~pnxf
)

【参考サイト】
ドラッグ&ドロップでファイル名を取得する | 初心者SEのとりあえずメモ日記

Why do not you register as a user and use Qiita more conveniently?
  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