1.

Solve : simple batch question?

Answer»

a simple question about batch:

NEED to write a .bat which references another file in the same dir as the batch. Do I have to give the whole dir STRING, or is there a possibility to "pass" the dir?

Example:
the FOLLOWING bat exsist in as: d:\dir1\mystart.bat

start C:\someprogram.exe d:\dir1\sameparameter.ini


This will not work for me:

start c:\someprogram.exe sameparameter.ini


It seems I have to 'pass in' the string
Any suggestion? Huh?Make sure you have quotations around the path, quotations better define seperations when CMD is parsing.

So basically try this:

Code: [Select]start "C:\someprog.exe" "sameparameter.ini"
Or just forget the start commmand and just type in the actually program path and parameters again with the quotations(Sometimes the Start command is a bit fussy..)

Code: [Select]"C:\someprog.exe" "d:\dir1\sameparameter.ini"
Usually when passing parameters, programs WANT a full path name, you can try and cut down on the code in your bat program by using the %CD% variable since the INI file is right there with your batch program:

Code: [Select]"C:\someprog.exe" "%CD%\sameparameter.ini"

Reply back with your findings.



Discussion

No Comment Found