Folder with space char

Nov 3, 2012
27
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
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,461
88
Albuquerque, NM
prospero.unm.edu
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
27
0
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
27
0
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
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,461
88
Albuquerque, NM
prospero.unm.edu
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"
 
Nov 3, 2012
27
0
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
4,461
88
Albuquerque, NM
prospero.unm.edu
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
Thread starter Title Forum Replies Date
fishman@panix.com Startup Folder? Support 3
C writing folder names with JPSoft special chars like &...... Support 4
R How to? Set default application in a special folder Support 4
R How to? Open Take Command at current folder Support 7
D How to? Pass OpenHere Folder to CMD? Support 6
Chen Touboul When i try to delete an empty folder i got "the dirctoy name is invalid" Support 3
C How to bypass UAC warning when shortcut in \Startup folder ? Support 9
CWBillow Clearing out the Windows Temp folder Support 2
J directory or folder to start in Support 2
vefatica Refresh a folder in File Explorer? Support 0
P How to? Delete subfolders but not the folder itself Support 11
vefatica Shortcut/start-up folder nonsense Support 20
cgunhouse Crash on View/Folder Support 1
D Fixed Cut and paste in TC's file/folder view does not remove file Support 17
D Version 18 changed the naming convention of TC's folder Support 5
C How to? COPY ftp folder query Support 7
fpefpe How to? folder / explorer window Support 10
rps Documentation Folder combo box docs Support 1
J Startup folder Support 6
C DEL, connected Web folder, report Support 1
T How to? Adding TCC to startup folder Support 6
jbanaszczyk TCMD 16 Install - download folder Support 2
I How to? Save and restore folder timestamps Support 22
gschizas How to? How can I use select with a folder that already contains parentheses? Support 7
C Suggestions for Compare Folder Tree routine Support 5
J Change folder TCC starts in Support 2
gschizas Installation folder for TCMD x64 15.1 is wrong Support 5
D Folder/List view changed in v15 Support 8
C Startup folder not working on v15 Support 6
N WAD Take Command and UNCs for Folder List Support 10
M Sync folder/list view with command window? Support 2
fpefpe How to? Plugin Folder Support 1
vefatica New desktop and StartUp folder? Support 4
M Folder View Freezing Support 10
CWBillow Make a folder named Date-Time Support 18
C Problem navigating folder view Support 11
vefatica OT:Explain Win7's "start menu" folder? Support 17
CWBillow Sync Folder Tree and Command Window? Support 11
L Thanks from larryalk was Cannot apply Start in folder for Tcmd Support 11
L Cannot apply Start In folder for Tcmd Support 15
J Find Files - changing folder Support 1
JohnQSmith Folder pane right-click rename Support 2
Phileosophos Unzip doesn't extract to specified output folder Support 5
D Changed order of folder names in @file Support 4
C how to copy to folder where I need admin rights Support 5
P Sync /w won't delete in ftp folder Support 1
S Can Take Command show TortoiseSvn folder icons? Support 9
gschizas pdir crashes horribly in one specific folder Support 5
D Always get shortcut in Start Menu folder Support 6
D How to set folder directory from command line? Support 4

Similar threads