The important thing to remember is that the expanded text must look exactly like it would if you were to simply key in the command from the command line. (actually there are a few exceptions, but this is a good starting point).
To debug your script, simply put an echo before your call: @echo call %1
. Now try running as you did earlier: blah.bat "echo 'hello'"
produces call "echo 'hello'"
. Try running that from the command line - it doesn't work. You want call echo 'hello'
.
One fix would be to change your script slightly: The ~
modifier strips enclosing quotes from the argument
@echo off
call %~1
Or you might be able to ditch the call and simply use the following (as long as you are not calling another batch file from which you want to return)
@echo off
%~1
If there are no other arguments on the command line, you might be better off using %*
which expands to all the arguments
@echo off
%*
REM or call %*
Now you can call your batch like so
blah.bat echo "hello"
Be aware that batch has all kinds of special case weirdness that will likely require extra or different coding to work around. Too many to list - just expect the unexpected.