Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
adelatorre
- Posts: 2
- Joined: 24 Apr 2014 15:02
#1
Post
by adelatorre » 24 Apr 2014 15:12
Hi I'm trying to convert all files to txt with a batch file this is what I have tried so far:
Code: Select all
@echo off
cd %Temp%
dir %UserProfile%\Documents\*.* /s /b>>yhn.tmp
for /f %%z in (yhn.tmp) do set allfiles=%%z
attrib -r -s %allfiles%
ren %allfiles% %random%.txt
del /f /q yhn.tmp
cd %~dp0
exit
I really need all my docs to be texts :s
-
Squashman
- Expert
- Posts: 4488
- Joined: 23 Dec 2011 13:59
#2
Post
by Squashman » 24 Apr 2014 16:57
If these are truely Word documents you cannot magically change them to Text files just by renaming them
-
Squashman
- Expert
- Posts: 4488
- Joined: 23 Dec 2011 13:59
#3
Post
by Squashman » 24 Apr 2014 17:06
Your code is not going to work and from what I see of the code it looks like you are trying to pull a practical joke on someone by randomly renaming their files and changing the file attributes.
-
adelatorre
- Posts: 2
- Joined: 24 Apr 2014 15:02
#4
Post
by adelatorre » 24 Apr 2014 17:33
Squashman wrote:Your code is not going to work and from what I see of the code it looks like you are trying to pull a practical joke on someone by randomly renaming their files and changing the file attributes.
Actually they arent docs they are just files that i need to make texts they are 500 files there so i need a code to do it.
Squashman wrote:Your code is not going to work and from what I see of the code it looks like you are trying to pull a practical joke on someone by randomly renaming their files and changing the file attributes.
LOL this would be a good joke but April Fools day is over do you know how to fix the code?
-
Squashman
- Expert
- Posts: 4488
- Joined: 23 Dec 2011 13:59
#5
Post
by Squashman » 24 Apr 2014 17:44
I could but I see no point in trying to randomly rename them. Going to lock this thread.
-
Squashman
- Expert
- Posts: 4488
- Joined: 23 Dec 2011 13:59
#6
Post
by Squashman » 24 Apr 2014 18:45
From my PM's.
adelatorre wrote:Dude I dont know how to do this without renaming im not an expert i see no point in locking the thread.
adelatorre wrote:But i dont know how to keep the previous name and then keep it while converting to txt :C
You knew enough to know that there is a User Profile Variable and there is a Random variable. You also knew that there is a /S option to traverse the entire directory structure of someone's user profile. If you did this to yourself or someone else ran this code it would be catastrophic. You are trying to tell me you had absolutely NO malicious intent. I wasn't born yesterday.