Computing.Net > Forums > Programming > Batch to add filename to txt file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Batch to add filename to txt file

Reply to Message Icon

Name: Seymour Clufley
Date: November 13, 2006 at 05:09:41 Pacific
OS: Windows XP Professional
CPU/Ram: Ahtlon 64 3200, 2gb RAM
Comment:

Hello!

I've made a program that scrambles and deletes files. When the program starts, it reads the contents of a txt file containing the full paths and names of files to be wiped. The txt file is called "fordeletion.txt"

I can use the scrambling program itself to manually add files to this txt file, but I want to be able to right-click on any file in Explorer and click on an option "Mark for deletion". Ideally, this would add the full path and name of the file to a new line in the "fordeletion.txt". I'm guessing this can be achieved using a batch file?

Unfortunately I don't know anything about batch files! If somebody can tell me the code that the batch file would need, I'd be very grateful. Ideally, I need the batch file to add the right-clicked file's path and name to a new line in the "fordeletions.txt".

All help gratefully appreciated!

Thanks in advance,
Seymour.



Sponsored Link
Ads by Google

Response Number 1
Name: IVO
Date: November 13, 2006 at 06:15:13 Pacific
Reply:

Sorry, but what you wish to achieve is far beyond the plain capabilities of batch files.

A batch file could be invoked by right clicking the file name from Explorer, but that association requires a "Shell Extension" that means to add registry entries.

Duties well known by programmers, but not in the domain of batch scripting.


0

Response Number 2
Name: Seymour Clufley
Date: November 13, 2006 at 13:58:52 Pacific
Reply:

I'm aware I need to change the Folder Options in XP, to add a new option in context menus. I know how to do that.

It's the adding the file's name to a text file that is stumping me!


0

Response Number 3
Name: IVO
Date: November 14, 2006 at 06:50:15 Pacific
Reply:

Well, if you are so expert in setting up shell extensions, here just a simple command to add the full path/name of the file right clicked, inspired by the well known Open, Print and so on items in the contextual menu:

C:\Windows\System32\Cmd.exe /C @Echo %~f1 >> fordeletion.txt

where fordeletion.txt would be prefixed by its full path.

I coded the command using the full path expansion for the %1 (%~f1) variable to catch its absolute address, but I don't know if that format is allowed in contextual menu settings.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Batch to add filename to txt file

Perl : converting .elf (binary) to .txt file www.computing.net/answers/programming/perl-converting-elf-binary-to-txt-file/20052.html

Perl : converting .elf (binary) to .txt file www.computing.net/answers/programming/perl-converting-elf-binary-to-txt-file/20055.html

Add FileName to a series of TXT files www.computing.net/answers/programming/add-filename-to-a-series-of-txt-files-/19981.html