So basically all I'm trying to do is write a script and in that script it deletes a folder. Now I know rmdir folderName normally works but the folder I want to delete is an invisible one done so by namming it 0160 while holding down the alt key. Any ideas on how to remove this folder from the cmd?
Asked
Active
Viewed 169 times
1 Answers
1
@echo off
setlocal
>nul chcp 65001
rd "\\?\%cd%\ "
Removes the folder in the current directory.
The folder path is not processed as to the use of \\?\
so may require an absolute path that the filesystem can handle as-is.
The space within the double quotes is the Alt + 0160
.
Code page for UTF-8 is set with chcp 65001
.
The batch-file needs to be encoded in UTF-8 with no BOM.
Use of \\?\
based from a similar issue that I answered:
- Reference: Trailing whitespace in filename
For file I/O, the "\\?\" prefix to a path string tells the Windows APIs to disable all string parsing and to send the string that follows it straight to the file system.

michael_heath
- 5,262
- 2
- 12
- 22
-
You've reached 2000 rep. Congrats. – Gerhard Sep 16 '18 at 16:14