0

I'm attempting to grab a text file from a folder for conversion to .xls using ssconvert. Currently I have:

for /F %%a in ('dir /b *.txt') do set FileName=%%~na 
ssconvert %FileName%.txt %FileName%.xls

However this results in this being run:

ssconvert thefile .txt thefile .xls

Which obviously doesn't work.

How would I get rid of the space between the FileName variable and the file extension?

pnuts
  • 58,317
  • 11
  • 87
  • 139
zib24
  • 149
  • 1
  • 1
  • 6

2 Answers2

1

Try:

for /F %%a in ('dir /b *.txt') do  ssconvert %%~na.txt %%~na.xls
Dr. belisarius
  • 60,527
  • 15
  • 115
  • 190
0

I think it has something to do with %%~na needing to be just %%a.

GolezTrol
  • 114,394
  • 18
  • 182
  • 210
  • I had a space in the batch script after ~na , making this completely my fault! Cheers anyway – zib24 Feb 24 '11 at 15:34