好吧,我一直在寻找我理解的答案,但一无所获。这是我第一次尝试批处理文件。这是我的一批
@echo off
cd /d "%~dp0"
start " " "F:\PUBLIC\shared\Lathe\ScrewMills\ShopAccess\CNC Programs\AEI_Transfer.bat" "%~f1"
If exist *.000 mv *.000 *.456
DEL /Q "*.456" "F:\PUBLIC\shared\Lathe\ScrewMills\ShopAccess\CNC Programs\CURRENT CNC PROGRAM\AEI"
move /y "*.000" "F:\PUBLIC\shared\Lathe\ScrewMills\ShopAccess\CNC Programs\CURRENT CNC PROGRAM\AEI"
pause
exit /b
如果我放置的文件与批处理文件位于同一文件夹中,但我需要从不同的文件夹中放置文件,则它可以工作。 我知道这已被涵盖,但我没有得到路径???
以下代码演示了用户如何将文件(分别为文件名)拖放到命令提示符窗口:
@echo off
setlocal EnableExtensions EnableDelayedExpansion
set "FileName=""
echo Enter file name with path or drag ^& drop a file on prompt below and press ENTER.
echo(
rem Prompt user for file name. The user can drag and drop a file and
rem press key RETURN or ENTER to enter the file name with path.
set /P "FileName=File name: "
rem Remove all double quotes from file name using a replace with delayed expansion.
set "FileName=!FileName:"=!"
rem Has the user really entered a file name?
if not "!FileName!" == "" (
echo(
echo The file name is: !FileName!
echo(
pause
)
endlocal
要了解所使用的命令及其工作原理,请打开命令提示符窗口,执行以下命令,并完整、仔细地阅读每个命令显示的帮助页面。
if /?
set /?