Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Dump to text file in winbatch

Posted on 2004-09-09
4
Medium Priority
?
769 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 1000 total points
ID: 12130703
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
ID: 12407819
Good suggest @venabili
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

885 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