🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: free.it.visual-basic
Article #374

Re: Vbscript - dos

#374
From: Rafunk
Date: Sun, 12 Nov 2006 09:53
37 lines
2222 bytes
AntFast wrote:
> Ciao a tutti
> Dove posso trovare informazioni per poter
> scrivere in  vbscript i vecchi comandi dos ?
> (tipo dir > listafile.txt, ecc...)
> Sto appena imparando che vbscript e' usato
> al posto del vecchio linguaggio dos per i
> file.bat...
> Grazie in anticipo per l'eventuale risposta.
> AntFast

Innanzitutto il "vecchio linguaggio dos per i file .bat" � ancora vivo e
vegeto in tutte le versioni di Windows.
Certamente VBScript � decisamente pi� potente, ma in quanto tale richiede
spesso molte pi� istruzioni per realizzare operazioni anche semplici come
quella che hai citato tu (dir > listafile.txt)
Qualcosa del genere:

dim fso, ts, fld, file, wsh
    set wsh=CreateObject("WScript.Shell")
    set fso=CreateObject("Scripting.FileSystemObject")
    set ts=fso.CreateTextFile("listafile.txt", True)
    set fld=fso.GetFolder(wsh.CurrentDirectory)
    for each file in fld.Files
        ts.WriteLine file.DateLastModified & "  " & file.Name
    next
    ts.Close

Qualche link utile
http://msdn2.microsoft.com/en-US/library/sx7b3k7y(VS.80).aspx
http://tinyurl.com/yekk8h
http://www.vbscript.it/HomePage/Default.asp
http://www.webmasterpoint.org/vbscript/home.asp

Bye

Raf
Technical Details
Message-ID: <4556ef21$0$13769$4fafbaef@reader3.news.tin.it>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.maxwell.syr.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!feeder.news.tin.it!spool.news.tin.it!not-for-mail
References: <wGu5h.2467$mZ5.421@tornado.fastwebnet.it>

Show Full Headers
Complete Article Headers
X-Google-Thread: f94ee,f85f7917273de692
X-Google-Attributes: gidf94ee,public
X-Google-Language: ITALIAN,ASCII
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.maxwell.syr.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!feeder.news.tin.it!spool.news.tin.it!not-for-mail
From: "Rafunk" <rafunkSPAM@NOTHANKSlibero.it>
Newsgroups: free.it.visual-basic
References: <wGu5h.2467$mZ5.421@tornado.fastwebnet.it>
Subject: Re: Vbscript - dos
Date: Sun, 12 Nov 2006 10:53:05 +0100
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
Lines: 39
Message-ID: <4556ef21$0$13769$4fafbaef@reader3.news.tin.it>
Organization: TIN.IT (http://www.tin.it)
X-Comments: Please send technical notifications to newsmaster@tin.it
NNTP-Posting-Host: 82.52.22.164
X-Trace: 1163325217 reader3.news.tin.it 13769 82.52.22.164:1786
X-Complaints-To: Please send abuse reports to abuse@tin.it