Path in batch file

H

Helge Haensel

Hallo NG!
WindowsXP/HE/S3
I have a batch.bat that needs a sometimes changing path to the target
files.
I.e.:

@echo off
C:\Programme\7-zip\7za a -tzip "longpathname\"<outfile.kmz>
"longpathname\"<inpfile.kml>

Is it possible to pass 'longpathname' as a parameter to batch.bat?
Thanks!
Vy 73! Helge
 
P

Pegasus \(MVP\)

Helge Haensel said:
Hallo NG!
WindowsXP/HE/S3
I have a batch.bat that needs a sometimes changing path to the target
files.
I.e.:

@echo off
C:\Programme\7-zip\7za a -tzip "longpathname\"<outfile.kmz>
"longpathname\"<inpfile.kml>

Is it possible to pass 'longpathname' as a parameter to batch.bat?
Thanks!
Vy 73! Helge

Sure is:
@echo off
echo parms=%*
"C:\Programme\7-zip\7za.exe" a -tzip "%*\outfile.kmz" "%*\inpfile.kml"

And here is how to invoke the batch file:
MyBatchfile.bat parm1 parm2 parm3 . . .

I recommend that you put your double quotes around the whole entity of
path+filename, not just part of it.
 
H

Helge Haensel

Sure is:
@echo off
echo parms=%*
"C:\Programme\7-zip\7za.exe" a -tzip "%*\outfile.kmz" "%*\inpfile.kml"

And here is how to invoke the batch file:
MyBatchfile.bat parm1 parm2 parm3 . . .

I recommend that you put your double quotes around the whole entity of
path+filename, not just part of it.
Thanks, that looks good. Does the syntax also handle 'longpathname'
containing spaces correctly?
Helge
 
P

Pegasus \(MVP\)

Helge Haensel said:
Thanks, that looks good. Does the syntax also handle 'longpathname'
containing spaces correctly?
Helge

Why don't you give it a try?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top