Pergunta

Is it possible to start another batch file and pass along multiple parameters with spaces, using the start command?

Here is how my program currently works:

main program starts > sees its outdated > calls updater (data1.exe) > updater copies new version over > It tries to delete the old version, but it can't. The old version is still marked as being used, from when it called the updater.

That's why the call command won't work. Do I need to use start then? How would that work?

This was the original line of code... the one that calls the updater and passes the variables along:

call "%dirofbatch%data1.exe" "%downloc%" "%dirofbatch%" "%lver%" "%lget%"

I'm stumped.

EDIT: I should mention that "data1.exe" is just an exe'd batch file.

Foi útil?

Solução

How to read parameters in a batch file:

  1. caller batch

    start "" "%dirofbatch%data1.exe" "%downloc%" "%dirofbatch%" "%lver%" "%lget%"
    
  2. called batch

    set "parm1=%~1"
    set "parm2=%~2"
    set "parm3=%~3"
    set "parm4=%~4"
    echo %parm1% %parm2% %parm3% %parm4%
    
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top