using ^ in filename

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

using ^ in filename

Zaaphod
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
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: using ^ in filename

Jonas Maebe-3
On 2019-05-09 06:02, James Richters wrote:
> 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.

https://forums.tomshardware.com/threads/when-did-become-special-on-the-command-line.1071200/


Jonas
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal