Reputation: 1
I'm working on a line of code in my batch file where it will scan a users profile and display all the .txt files stored within the profile.
Line in bold above the code are my comments upon what its doing.
This is what I have, but I keep getting an error that I can't figure out how to fix.
(Scan PC's C:/Active_UserProfile) (Search any .txt) (A:Below)
cd /D C:\%USERPROFILE% DIR *.txt /A /s /b > %CD%\%INPUT%\Example.txt
A:(create .txt in current working directory showing paths to .txt's)
Batch lines:
echo "Scanning Directory: C:\%USERPROFILE%
echo "Terminal Destination:%CD%\%INPUT%"
cd /D C:\%USERPROFILE% DIR *.txt /A /s /b > %CD%\%INPUT%\Example.txt
echo "Scanning Directory: C:\%USERPROFILE%
echo "Terminal Destination:%CD%\%INPUT%"
Output:
"Scanning Directory: C:\Users\josep"
"Terminal Destination: M:\_TodaysRefresh\6"
The filename, directory name, or volume label syntax is incorrect.
"Scanning Directory: C:\Users\josep"
"Terminal Destination: M:\_TodaysRefresh\6"
Upvotes: 0
Views: 285
Reputation: 38708
I'm suggesting that this line cd /D C:\%USERPROFILE% DIR *.txt /A /s /b > %CD%\%INPUT%\Example.txt
should be two lines split before the DIR
.
Then I would have to tell you that it's just %USERPROFILE%
not C:\%USERPROFILE%
Upvotes: 1