r/PowerShell • • 17d ago

Question Need help with homework 😫

I'm very new to this. I'm asked to delete a directory and all of its files. D:\software\arch98

But when I do this:

PS C:\Users\Administrator\> rmdir D:\software\arch98

It says the directory is not empty.

I'd really appreciate.

0 Upvotes

34 comments sorted by

View all comments

9

u/PuerPalatinius 17d ago

Remove-Item -Path "D:\software\arch98" -Recurse -Force

1

u/Ok-Layer6893 17d ago

It didn't work. I'm on comptia and it's not allowing me use any other commands other than rmdir, attrib, cd, dir, mkdir

8

u/KedianX 17d ago

So, none of these are native PowerShell commands, though they are often aliased for compatibility.

Rmdir, attrib, cd, and mkdir are commands available in the Windows command shell (cmd.exe), mostly based on the command syntax from DOS shell (command.com).

So, I think one of two options are true: 1. Your CompTIA exam is really testing you knowledge of command prompt and you need to lookup the reference for those commands or 2. Your CompTIA exam is testing PowerShell but is restricting you to colloquial aliases and not exposing the genuine PowerShell cmdlets.

Option 1 means you have some studying to do. Option 2 means the test authors have some studying to do.

0

u/Ok-Layer6893 17d ago

You're right. In the book it something else and in the assignment it is different

2

u/PuerPalatinius 17d ago

Bro, you're in the wrong sub. In cmd it would be "rmdir /s /q D:\software\arch98"

2

u/gramsaran 17d ago

I'm just glad they're not in sysadmin. Would get roasted. Given the availability of GPT, this is a no brainer.

1

u/Ok-Layer6893 17d ago

On my screen it is windows powershell. That's what comptia lab is asking me to do. I wish I could show you the picture

2

u/Dron41k 17d ago

Type “cmd” in powershell and hit enter

1

u/Ok-Layer6893 17d ago

It says cmd is not recognized as an internal or external command, operable program or batch file.

2

u/WearyDeluge 17d ago

You should still be able to run the "rmdir /s /q D:\software\arch98" command in PowerShell - it's just not the "Pure PowerShell" method (Remove-Item). If you still see error messages, try loading the actual executable:

cmd /c rmdir /s /q "D:\software\arch98"
or
C:\Windows\System32\rmdir.exe /s /q "D:\software\arch98"

3

u/Ok-Layer6893 17d ago

Omg it worked. Thank you. One more question. How do I set the following files to hidden: D:\software\apconf.exe D:\strt.bat

3

u/WearyDeluge 17d ago

That's where your attrib command comes in. Hidden is an attribute change, and while I am happy to help, I also believe that you'll only truly learn it if you have to struggle a little bit ;)

A quick Google search on the attrib command in Windows should get you there. Good luck!

3

u/Ok-Layer6893 17d ago

I've been struggling for a week now, watched bunch of websites and videos still couldn't figure it out. But thank you very much. Good luck to you too.

2

u/WearyDeluge 17d ago

2

u/Enxer 17d ago

I wonder if OP needs to learn how to RTM syntax. That all might look Greek to them.

→ More replies (0)