Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Dealing with speech marks in batch files

$
0
0

Hi

I have a batch file that processes files in a given folder. It takes the folder path as a parameter (%1) and then processes certain files within that folder. 

My problem is that the folder parameter passed to the batch file needs to be enclosed in speechmarks as they often contain spaces. My batch file then appends the files to the parameter which breaks the command. 

Here's an example

mybatchfile.bat:

echo %1\mypdf.pdf

end:

The command line;

mybatchfile.bat "c:\temp\folder"

results in an output of;

"c:\temp\folder"\mypdf.pdf

I need the speech marks to be moved so that they enclose the complete pdf path, thus:

"c:\temp\folder\mypdf.pdf"

Really I need to insert the "\mypdf.pdf" string before the last speech mark. 

Any ideas how?


Olly


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>