0

I'm looking to make an exe or batch file that will delete a folder, however the folder location changes based on the User, so I'd like it to determine this based on what user is currently logged in, or by asking the person running the exe/batch to type in the user name so it knows where to look.

The folder I'd like to have deleted is in the example below, where "PC" is the Login name that needs to match the current user or allow it to be entered.

C:\Users\PC.digilabs\ubuildabook\data

Thanks

Edited by UBAB_Support: it's not displaying correctly

3
Contributors
4
Replies
22
Views
2 Years
Discussion Span
Last Post by UBAB_Support
0

C:\Users\PC.digilabs\ubuildabook\data

For some reason it's not showing the "\" between PC and .digilabs

0

For some reason it's not showing the "\" between PC and .digilabs

Directories are seperated by the backslash. The path you are showing indicates that PC.digilabs is the name of the folder.

0

Use the USERNAME environment variables. On my machine with my current account it is

USERPROFILE=C:\Users\Jim

You can see the resulting command by

echo rd %USERPROFILE%\.digilabs\ubuildabook\data

If you use two backslashes before the "." when you post you get

C:\Users\PC\.digilabs\ubuildabook\data

Edited by Reverend Jim

0

Thanks for the info on both why my post was missing the \ and about the RD command.

The only change I had to make was adding /s/q after RD so it would remove all the files it contains without asking.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.