[fpc-pascal] using ^ in filename
James Richters
james at productionautomation.net
Thu May 9 06:02:02 CEST 2019
Does anyone know why I have issues using ^ in a filename on windows systems?
Everything works fine if I just run my program and open the file with a ^ in it, the issue I am having is when sending the filename in as a parameter. If I set my parameter to File^name then Paramstr(1)= FileName. If I set it to File^^Name then Paramstr(1)=File^Name If I put it in double quotes, then I get it as it is.
I notice something else odd trying to track this down. If I start my FPC program with a CALL from a windows batch file like this:
Call Test.exe %1 Then I get double ^ so if I run mybatch.bat "File^Name" then for some strange reason it passes "File^^Name" to test.exe
BUT if I do not use CALL and instead just make my batch file run the program without Call, then it comes in as I expect with just one ^.
Does anyone know what is going on here and why ^ gets left out of parameters with no quotes or why windows would put two of them if I call the program? I'm sure there is some kind of reason, but I can't find any information about why ^ is treated differently than any other character.
James
More information about the fpc-pascal
mailing list