Solved

Dump to text file in winbatch

Posted on 2004-09-09
4
716 Views
Last Modified: 2013-12-03
I am looking for a way to print the contents of a directory to a text
file using winbatch.

 Here is what I have currently.

DirChange("\\mxbiis01\c$\ftp\LocalUser\dkftp")
Handle=FileOpen("C:\list.txt","WRITE")
FileWrite(handle,"FileItemPath")
FileItemPath("*.*")   ; get file list
FileClose(handle)

I know the problem is with the filewrite command.

Any suggestions
0
Comment
Question by:healthcheckinc
  • 2
4 Comments
 
LVL 4

Accepted Solution

by:
void_main earned 250 total points
Comment Utility
Hi healthcheckinc!

I suggest this way:

instead of
-------------------8<---------------------------------------
DirChange("\\mxbiis01\c$\ftp\LocalUser\dkftp")
Handle=FileOpen("C:\list.txt","WRITE")
FileWrite(handle,"FileItemPath")
FileItemPath("*.*")   ; get file list
FileClose(handle)
-------------------8<---------------------------------------


write this code
-------------------8<---------------------------------------
ShellExecute("dir", ">c:\list.txt", "\\mxbiis01\c$\ftp\LocalUser\dkftp", @NORMAL, "")
-------------------8<---------------------------------------

this invokes a system call and forces the "dir" command to write the output to the textfile.
The disadvantage is, the dir command writes additional information to that file.

regards
void_main
0
 
LVL 4

Expert Comment

by:void_main
Comment Utility
Good suggest @venabili
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Event ID 10010 3 34
display png images in VB6 4 335
Handle Exceptions during instantiation 28 387
TFS Branching 4 63
This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now