Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Folder with space char

Nov
33
0
Hi guys, my batch .btm file isn't work if it runs inside a folder containing spaces in its name. Should i configure the tcmd.ini file to fix it? Thank you
 
Hi guys, my batch .btm file isn't work if it runs inside a folder containing spaces in its name. Should i configure the tcmd.ini file to fix it? Thank you

A little more information would be helpful: Exactly what command doesn't work, and how does it not work? But in general, you should quote any filename that contains spaces, or that might contain spaces.
 
Every command i run... also a simple:

@ECHO OFF
ECHO=Hello.>>%~dp0log.txt
EXIT /B

TCC gives unknown command because the dir with spaces is cut:

C:\my dir -> TCC reads C:\my
 
These are the steps i follow:

1) I create my cmd batch as above.
2) With TCMD BATCOMP i create the btm file
3) I run the btm file
 
Every command i run... also a simple:

@ECHO OFF
ECHO=Hello.>>%~dp0log.txt
EXIT /B

TCC gives unknown command because the dir with spaces is cut:

C:\my dir -> TCC reads C:\my

Does CMD.EXE handle that line any differently?

Does it work as you would expect if you quote the filename, e.g.

ECHO Hello.>>"%~dp0log.txt"
 
Perfect! So is it useful to use quotes also in:

PUSHD %~dp0 ??

I thought that the quotes were unnecessary with %~dp0.

Thank you!!
 
Perfect! So is it useful to use quotes also in:

PUSHD %~dp0 ??

I thought that the quotes were unnecessary with %~dp0.

Thank you!!

There are a few commands like PUSHD, CD, and CDD which 'know' they can only receive one argument, so you can omit the quotes. Still, it's probably best to use the correct syntax; if an argument contains spaces, quote it.
 

Similar threads

Back
Top