• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Windows Script Generation Problems

New Here ,
May 16, 2007 May 16, 2007

Copy link to clipboard

Copied

I am generating a WSF for use on my servers, but the method I'm using comes up with a strange problem.

I am using CFFile to write and append to a file on my webserver which is pretty elementary. The problem is that when I execute the WSF with CScript.exe, it complains about improper tag matching. If I open the file in notepad, make no changes, then save the file, the script will execute just fine.

I have tried pushing the file to the browser using the:
<cfcontent type="text/scriptlet">
<cfheader name="Content-Disposition" value="attachment; filename=#Filename#.wsf">
<cffile action="read" file="#OSPath#\TempWSF\#Filename#.wsf" variable="WSFContent">
<cfoutput>#WSFContent#</cfoutput>

and I've used both mime types: text/scriptlet and text/plain with the same results as the file created on the web server.

Any ideas how I can prevent having to open each WSF with notepad and resaving them all?

Thanks,
Rocky
TOPICS
Advanced techniques

Views

224

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
May 16, 2007 May 16, 2007

Copy link to clipboard

Copied

LATEST
I've done quite a bit of work with WSF's (using VBScript mostly), and ColdFusion, so I'm hoping I can help here.

The behavior you're describing is pretty odd, and all I can tell you is that it "smells" like a new-line related issue. I noticed you're using the "fixnewline" attribute, is there a specific reason for this? I would first try removing that attribute (or set it to "no"), and see if the problem persists.

Secondly, have you tried buffering your output? Building a file in the way that you are (write, append, append, append, append...) isn't the most efficient way to approach it, and I've experienced some quirky issues with ColdFusion in the past, where multiple cffile (or cflog) in a row can result in some unreliable results. (lines written to the file in the wrong order for example)

I would prefer you built the entire file-contents into a single string var, and then write that string to disk in one round trip, like so:

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation