0

I have this simple batchscript...

@ECHO OFF
:batch
IF "%~1"=="" GOTO end
ECHO video=FFVideoSource("%~f1")>"%~f1.avs"
ECHO audio=BassAudioSource("%~f1")>>"%~f1.avs"
ECHO AudioDub(video,audio.TimeStretch(pitch=432.0/4.4))>>"%~f1.avs"
SHIFT
GOTO batch
:end

which when executed from command prompt works fine in all cases, but breaks when I drag&drop a file with an underscore in its filename. Several avs-files are created. I've found them in %~1 its parent directory and even in "C:\Documents and Settings\Admin".
Does anyone know why an underscore would be an issue for drag&drop?
I'm on WinXP, that doesn't have anything to do with it, does it?

zs2020
  • 53,766
  • 29
  • 154
  • 219
Reino
  • 3,203
  • 1
  • 13
  • 21
  • 1
    `file with underscore` : please show the whole complete file name from your example. – Endoro Aug 21 '13 at 12:45
  • Even "test_-_test.mp4" would do, but now I believe, after trying in another directory, that the original directory name is the culprit, namely "D:\Audible\[..power,progressive,symphonic,gothic..]\Videos". Several avs-files are created: "[..power.avs" in D:\Audible and "progressive.avs" and "symphonic.avs" in C:\Documents and Settings\Admin when I drag&drop a file with an underscore in its filename. No problem through command prompt and no problem in D:\Audible through drag&drop for instance. – Reino Aug 21 '13 at 12:58
  • you can not have path names with dots like `"D:\Audible[..power,progressive,symphonic,gothic..]\Videos"`. – Endoro Aug 21 '13 at 14:32
  • It's a relic from years ago. A friend of mine used to name directories like that and I never changed it. Now it appears the drag&drop feature doesn't like directories like that. I removed the brackets and dots and now the batch-script is working as it should. Thanks for your help. – Reino Aug 21 '13 at 18:17

1 Answers1

0

The problem is the name of the directory, in this case the commas are the problematic characters.

When drag&drop a file, it will only be quoted when a space is found in the name.
But in this case the commas will split the name into multiple arguments.

D:\Audible[..power progressive symphonic gothic..]\Videos\test_-_test.mp4

In this case you could use %* to access the original fullname, but in some other cases (when a & is in the name) you need a more complex solution.

SO: Drag and drop batch file for multiple files?

Community
  • 1
  • 1
jeb
  • 78,592
  • 17
  • 171
  • 225