在fo​​r循环变量删除文件扩展名 [英] Removing file extension in a for-loop variable

查看:155
本文介绍了在fo​​r循环变量删除文件扩展名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何删除扩展名(包括点),使我得到

  file01
file02

而不是

  file01.pdf
file02.pdf

每当我引用下面的批处理。

  ECHO OFF
在(* .PDF)%% X千万回声%%点¯x
暂停


解决方案

我找到了一些好的想法此链接给你:的批次:删除文件扩展名
但是此基础上,你可以这样做:

 关闭@echo
在(* .PDF)%% X千万呼应%%〜NX

所有最好的,

How to remove the extension (including the dot) such that I get

file01
file02

instead of

file01.pdf
file02.pdf

whenever I invoke the following batch.

echo off
for %%x in (*.pdf) do echo %%x
pause

解决方案

I found this link for you for some good ideas: Batch: Remove file extension. But based on that, you can just do this:

@echo off
for %%x in (*.pdf) do  echo %%~nx

All best, ember

这篇关于在fo​​r循环变量删除文件扩展名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆