---
title: "Spara Variabel i .Txt fil"
type: "forum-thread"
url: "https://www.webforum.nu/amne/asp/67152-spara-variabel-i-txt-fil"
topic: "ASP"
topic_url: "https://www.webforum.nu/amne/asp"
author: "fjulll"
published: "2003-02-04T14:49:21.000Z"
updated: "2003-02-04T15:10:06.000Z"
replies: 2
views: 163
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/asp/67152-spara-variabel-i-txt-fil"
---

# Spara Variabel i .Txt fil

## #1 — fjulll, 2003-02-04T14:49Z

Jag undrar om nån kan skicka ett script där man sparar en variabel i en .Txt fil. de ska helst också vara så att när den sparar variabeln så ska den också spara vilken tid det var så de kanske blir såhär i txt filen:'
\<tid\>
\<variabel\>

är det nån som kan skicka ett sådant???

Permalänk: https://www.webforum.nu/p/67152

## #2 — solbulle, 2003-02-04T15:07Z

Du kan ju bolla med detta, fr Microsoft. <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/jsmthwrite.asp>

```
<%
Function WriteToFile
   Const ForReading = 1, ForWriting = 2
   Dim fso, f
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set f = fso.OpenTextFile(server.mappath("testfile.txt"), ForWriting, True)
   f.Write now() & vbcrlf
   f.Write "Hello world!" & vbcrlf
   Set f = fso.OpenTextFile(server.mappath("testfile.txt"), ForReading)
   WriteToFile =   f.ReadAll
End Function

response.write WriteToFile
%>
```

Permalänk: https://www.webforum.nu/p/940592

## #3 — solbulle, 2003-02-04T15:10Z

typ:

```
<%
varstring = request.querystring("varstring")
Function WriteToFile(varstring)
   Const ForReading = 1, ForWriting = 2
   Dim fso, f
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set f = fso.OpenTextFile(server.mappath("testfile.txt"), ForWriting, True)
   f.Write now() & vbcrlf
   f.Write varstring & vbcrlf
   Set f = fso.OpenTextFile(server.mappath("testfile.txt"), ForReading)
   WriteToFile =   f.ReadAll
End Function

response.write WriteToFile(varstring)
%>
```

Permalänk: https://www.webforum.nu/p/940595

---

Tråden på webben: https://www.webforum.nu/amne/asp/67152-spara-variabel-i-txt-fil
