Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Dump to text file in winbatch

Posted on 2004-09-09
4
Medium Priority
?
757 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
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…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

722 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