views:

52

answers:

2

Hello,

Let's say, the user drag and drops an file into my batch file, which causes that the batch file copies the file to a certain directory. the problem is the following command:

copy "%1" "C:\path\to\it"

The problem here is the quotes around%1. When you drag and drop something in a batch file, normally, it wouldn't put quotes, so everything's fine. But when i convert my batch file to EXE, it actually puts quotes there.

So, what i want to do is, checking if the file does have quotes, if not, than do the command above, otherwise, do the command without quotes.

Thanks.

A: 

The problem is the process by which you are converting to EXE. Try a different BAT to EXE converter.

Wongamatic
can't i just check for quotes?
YourComputerHelpZ
+2  A: 

Would the following work?

copy %1 "C:\Dir1\Dir2"

my few attempts to find a problem not quoting %1 have not resulted in adverse effects.

shroudednight
+1. Actually, file names with spaces always get passed with quotes and those quotes *are* part of the argument. Putting quotes around `%1` is usually superfluous. This doesn't have to be related to the batch to exe converter.
Joey
Yes, i get this. Thanks.
YourComputerHelpZ