writefile - quoted filename?

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
highend
Posts: 14954
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

writefile - quoted filename?

Post by highend »

Not sure if this is a bug or not...

Code: Select all

$HiDriveTempBatchFile = quote("D:\temp\a und b.txt");
msg $HiDriveTempBatchFile;
writefile("D:\temp\a und b.txt", "@Echo off".<crlf>, o, ta);
Leads to the output:

Code: Select all

"D:\temp\a und b.txt"
and the writefile succeeds.

But if I replace the path in the writefile line with the $HiDriveTempBatchFile variable, it isn't working anymore...

Code: Select all

$HiDriveTempBatchFile = quote("D:\temp\a und b.txt");
msg $HiDriveTempBatchFile;
writefile($HiDriveTempBatchFile, "@Echo off".<crlf>, o, ta);
Unbenannt.png
Any hints?
To see the attached files, you need to log into the forum.
One of my scripts helped you out? Please donate via Paypal

admin
Site Admin
Posts: 66362
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: writefile - quoted filename?

Post by admin »

Why do you quote? This adds quotes to the filename which is illegal of course.

Code: Select all

$HiDriveTempBatchFile = quote("D:\temp\a und b.txt");
Simply do this instead:

Code: Select all

$HiDriveTempBatchFile = "D:\temp\a und b.txt";

Post Reply