Reputation: 9
I want to create a batch file to delete the following path across the network via automated scripting.
So far I'm using :
REM <start>
@echo off
rmdir /s /q c:\users\%allusersprofile%\ppTemp\
REM <end>
Where %alluserprofiles%
would be each individual user and ppTemp
is the dir that needs removed.
The code above isn't working.
Help!
Upvotes: 0
Views: 333
Reputation: 11
The environment variable reference %AllUsersProfile% returns a fully qualified path, so prefixing it with C:\users\
in the rmdir command is redundant. It also returns the path for program data storage for ALL USERS, not individual users; it's not clear from your question which behavior you want.
As an example, the result I see for echo %AllUsersProfile%
is
C:\ProgramData
C:\Documents and Settings\All Users
For the UserProfile environment variable, echo %UserProfile%
returns
C:\Users\MyUserName
C:\Documents and Settings\MyUserName
So assuming you're using Windows 7 or Vista, you probably want to change the rmdir command to:
rmdir /s /q "%UserProfile%\ppTemp\"
which should resolve to a path of C:\Users\username\ppTemp\
.
Upvotes: 1