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?

0

2 Answers 2

1

Try:

for /F %%a in ('dir /b *.txt') do  ssconvert %%~na.txt %%~na.xls
Sign up to request clarification or add additional context in comments.

Comments

0

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

1 Comment

I had a space in the batch script after ~na , making this completely my fault! Cheers anyway

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.