这个问题的答案是用来采取什么样一个人说,并修改它...
paxdiablo是在正确的道路上,但没有被拷贝/ pasteable。为了他的工作正常(也许它只是为了我运行Windows7),你需要2个文件。
的第一个文件:drag_drop.bat
@echo off
echo Drag and drop your .txt file here, after that press Enter:
set txtfile=
set /p txtfile=
echo.%txtfile%
call c:\temp\process_filename.bat %txtfile%
第二个文件:process_filename.bat
FOR %%i in (%txtfile%) do set txtdir=%~dp1
cmd /K "cd %txtdir%"
我不得不使用2档的原因是因为它的触发%〜DP1(从paxdiablo语法是错误的 - 没有冒险我知道你有187k代表,我给你的道具[你有%%〜dpi,在回声中使用%%来禁用特殊字符'%'和dp1是分界符允许您从文件名中去除引号,文件路径 - 与%%〜nxi相同的内容])
无论如何,您需要调用批处理文件传递其他文件名。这是第二个进来的地方。这个去除必要的信息,然后允许你访问该路径,然后在你的cmd提示符下打开该目录。
或者
您可以从同一个文件中做到这一点...
@echo off
setlocal
IF '%process%'=='1' goto processFile
echo Drag and drop your .txt file here, after that press Enter:
set txtfile=
set /p txtfile=
echo.%txtfile%
set process=1
call c:\temp\dragdrop.bat %txtfile%
:processFile
set txtdir=
FOR %%1 in (%txtfile%) do set txtdir=%~dp1
cmd /K "cd %txtdir%"
endlocal
伟大的工作:d感谢 – Dels 2009-05-25 09:34:12