In calling a script an quality (=) seems to be tantamount to a space.
For example
C:>MyScipt.cmd par1
C:>MyScipt.cmd=par1
behave the same way
Likewise
C:>MyScipt.cmd
is ok
C:>MyScipt.cmdNosuchFile
produces, as expected
"is not recognized as an internal or external command..."
but
C:>MyScipt.cmd/x
is ok (/x is taken as par1)
however, if one includes the path
C:>C:\wherever\MyScipt.cmd/x
one gets
The directory name is invalid.
All the best, Timo
--
Prof. Timo Salmi mailto:t...@uwasa.fi ftp & http://garbo.uwasa.fi/
Hpage: http://www.uwasa.fi/laskentatoimi/english/personnel/salmitimo/
Department of Accounting and Finance, University of Vaasa, Finland
Useful CMD script tricks http://www.netikka.net/tsneti/info/tscmd.php
It's always been that way Timo, same as comma, semicolon, even back to
MSdos 3.3 where I came in.
@echo off
call :echo 1=2;3,4
call :echo "1=2;3,4"
pause
goto :EOF
:echo
echo %1-%2-%3-%4
--
Regards,
Mic
> however, if one includes the path
> C:>C:\wherever\MyScipt.cmd/x
> one gets
> The directory name is invalid.
My mistake, I didn't pay attention to what you were posting Timo.
The above seems to be a parsing issue where the /x is interpreted as \x
CMD.EXE does allow / or \ to be used in a path. See below.
D:\>type d:\myscript.cmd
@echo off
echo %1
pause
D:\>d:/myscript.cmd abc
abc
Press any key to continue . . .
D:\>d:\myscript.cmd abc
abc
Press any key to continue . . .
--
Regards,
Mic
I have the files
c:\temp\test.bat
and
c:\temp\test\my.bat
both contains only
echo %0
Now I test
test
test/my.bat
..\temp\test/my.bat
c:\temp\test/my.bat
Only the last variant calls my.bat, all other calls test.bat with /
my.bat as parameter.
So only with absolute paths my.bat is taken as part of the filename.
And as foxidrive said:
Standard delims are "=,;" and "(" and also ALT-255, ALT-255 is not the
same as a normal space, as you can see with %*
test,param %*=",param" %1="param"
test;param %*=";param" %1="param"
test=param %*="=param" %1="param"
test(param %*="(param" %1="(param"
test<ALT-255>param %*=" param" %1="param"
On 11 Mrz., 07:48, foxidrive <foxidr...@gotcha.woohoo.invalid> wrote:
> On 11/03/2011 17:29, Timo Salmi wrote:
>
> > however, if one includes the path
> > C:>C:\wherever\MyScipt.cmd/x
> > one gets
> > The directory name is invalid.
>
> My mistake, I didn't pay attention to what you were posting Timo.
>
> The above seems to be a parsing issue where the /x is interpreted as \x
>
> CMD.EXE does allow / or \ to be used in a path. See below.
> ...
> --
> Regards,
> Mic
This demonstrates that:
C:\>md C:\wherever\MyScipt.cmd
C:\>echo=echo=%~f0>C:\wherever\MyScipt.cmd\x.bat
C:\T>echo=C:\wherever\MyScipt.cmd\x.bat
C:\wherever\MyScipt.cmd\x.bat
Frank
C:\T>md C:\wherever\MyScipt.cmd
C:\T>echo=echo=%~f0>C:\wherever\MyScipt.cmd\x.bat
C:\T>C:\wherever\MyScipt.cmd\x.bat
C:\T>echo=C:\wherever\MyScipt.cmd\x.bat
C:\wherever\MyScipt.cmd\x.bat
For those wanting to try this here are the statements to copy and paste:
cd /d C:\
md C:\wherever\MyScipt.cmd
echo=echo=%~f0>C:\wherever\MyScipt.cmd\x.bat
C:\wherever\MyScipt.cmd\x.bat
rd /s /q C:\wherever
Frank
Quirks of previous command interpreters should not be expected to behave the
same in latter versions.