Folder with space char

Nov 3, 2012
25
0
#1
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
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,499
45
Albuquerque, NM
prospero.unm.edu
#2
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.
 
Nov 3, 2012
25
0
#3
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
 
Nov 3, 2012
25
0
#4
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
 
Nov 3, 2012
25
0
#6
Perfect! So is it useful to use quotes also in:

PUSHD %~dp0 ??

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

Thank you!!
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,499
45
Albuquerque, NM
prospero.unm.edu
#7
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.