Thursday, May 01, 2014

Lesson 6: Functions and Procedures (vbscript)

Functions and Procedures make your code modular. They help you to keep repeated statements as blocks of code that can be reused. Both functions and procedures do the same thing, except, Functions can return value. So as a good practice never let your functions have any statements to print(display) or get input from keyboard.

Let your functions take parameters and return the value. How does a function return a value? Function_name=value you want to return. Enough of theory.

This program finds the value of (a+b) squared.

(a+b)2 =a2 +2ab+b2

‘File-0105-1.vbs (this is file name I have)

Function Sq_ab(a,b)
    sq_ab=a*a + 2*a*b + b*b
End Function

Sub Print(str)
    wscript.echo str
End Sub

'Main program starts here

a=int(wscript.arguments(0))
b=int(wscript.arguments(1))
Print("The Square of (a+b) is " & Sq_ab(a,b))

Sample Output

C:\scripts>0105-1.vbs 2 3 //nologo
The Square of (a+b) is 25

C:\scripts>0105-1.vbs 7 9 //nologo
The Square of (a+b) is 256

C:\scripts>

Exercises for you.

1. Write functions for (a-b)2, a2-b2, (a+b)3 and so on

Saturday, April 19, 2014

Windows Scripting. Lesson 5. Magic Square

A magic square is one where the total of rows, columns and diagonals is the same.

Take a 3x3 magic square.

image

The Rules are pretty simple. The rule is called top-left rule.

1. Start with 1. Put it in the centre of the 1st row. So 1 is in (1,2) Row 1, Col 2.

2. Goto top left. In this case top is row 0, so top comes to the 3rd row. Left is row 1. So the next number is (3,1).

3. Continue with top left. Top of 3 is 2, left of 1 is 3rd column. So we are in (2,3).

4. Now the top left from 2,3 is 1,2. This place is occupied, you have a 1 there. So you need to go back to original location (2,3). Then come a place down but same column. So from 2,3 we come to 3,3. Put a 4 here. Continue this way.

5. In this case the totals of rows, col and diagonal is 15. Why 15?

6. We use the natural numbers 1 to 9. Sum of 1 to 9 is n(n+1)/2. In this example we have 9x10/2=45. We have 3 rows. So we get 45/3 or 15.

sub Print(str)
    wscript.echo str
end sub

' Main Program starts from here
dim x(3,3)
dim y
for a=1 to 3
    for b=1 to 3
        x(a,b)=0
    next
next

x(1,2)=1
a=1
b=2
for y=2 to 9
    olda=a
    oldb=b
    a=a-1
    b=b-1
    if a=0 then
        a=3
    end if
    if b=0 then
        b=3
    end if
    if x(a,b)>0 then
        a=olda
        b=oldb
        a=a+1
    end if
    x(a,b)=y
next
for a=1 to 3
    for b=1 to 3
        str=str & chr(9) & x(a,b)
    next
    wscript.echo str
    str=" "
next

- print procedure makes the printing easy.

- dim, defines an array. In this case it is an array 3 rows x 3 cols. Each value in the array is defined as 0. 1 is put then in the first row and second column.

- for loop rotates eight times for the eight numbers. a and b are the locations needed. We try top left, and if it is occupied (>0), then we go back to the original location and come one col down.

- the for loop then prints the 3 coloumns. Each row is formatted is by adding a tab (chr(9). When you compile and run this program, (magic3.vbs)

C:\scripts>magic3 //nologo
        6       1       8
        7       5       3
        2       9       4

C:\scripts>

 

Can we make a generic version of this program.  Where we can print for any odd number. Since vbscript does not allow to define an array with a variable, I have defined a large array (20,20) and allow to print a magic square. The beauty is you can pass the number as a parameter. If the parameter is even, then we add 1 and make it a odd number. The program is very similar to the previous program.

sub Print(str)
    wscript.echo str
end sub

sz=int(wscript.arguments(0))
if sz mod 2 = 0 then
    print "Argument Should be Odd"
    print "Changing to odd"
    sz=sz+1
end if
'sz=3
dim x(20,20)
dim y
for a=1 to sz
    for b=1 to sz
        x(a,b)=0
    next
next

x(1,(sz+1)/2)=1
a=1
b=(sz+1)/2
for y=2 to (sz * sz)
    olda=a
    oldb=b
    a=a-1
    b=b-1
    if a=0 then
        a=sz
    end if
    if b=0 then
        b=sz
    end if
    if x(a,b)>0 then
        a=olda
        b=oldb
        a=a+1
    end if
    x(a,b)=y
next
for a=1 to sz
    for b=1 to sz
        str=str & chr(9) & x(a,b)
    next
    wscript.echo str
    str=" "
next

Sample output.

C:\scripts>magicgen 5 //nologo
        15      8       1       24      17
        16      14      7       5       23
        22      20      13      6       4
        3       21      19      12      10
        9       2       25      18      11

C:\scripts>magicgen 7 //nologo
        28      19      10      1       48      39      30
        29      27      18      9       7       47      38
        37      35      26      17      8       6       46
        45      36      34      25      16      14      5
        4       44      42      33      24      15      13
        12      3       43      41      32      23      21
        20      11      2       49      40      31      22

An exercise for you. Can you use the n(n+1)/2 formula as mentioned earlier and print one line at the end of the program.

Sum of Rows/Col is _______

Like this

C:\scripts>magicgen 5 //nologo
        15      8       1       24      17
        16      14      7       5       23
        22      20      13      6       4
        3       21      19      12      10
        9       2       25      18      11
Sum of rows/col is      65

Friday, April 18, 2014

Windows Scripting (the normal shell) for Ex VB Programmers - Lesson 4–FileSystemObject Contd..

Continuing on FileSystemObject, Let us look at and example to extract the properties of a file. There are some new things introduced in this example

1. SUB. This is for a procedure. you can pass parameteres just like functions but just that you cannot return any values. I have put a simple procedure called Print, that takes a string as a parameter.

2. Parameteres.  You can pass parameteres to a vbscript. Wscript.argument, is where you can see the list.

Sub Print(x)
    wscript.echo x
end sub


set fso=CreateObject("Scripting.FileSystemObject")
set f=fso.GetFile(wscript.arguments(0))
print "Path               " & f.path
print "Date Created       " & f.datecreated
print "Date Last Accessed " & f.datelastaccessed
print "Date last modified " & f.datelastmodified
print "Drive              " & f.drivedir
print "Parent Folder      " & f.parentfolder
print "Size (Bytes)       " & f.size
print "Type of File       " & f.type

A few examples

C:\scripts>folder.vbs c:\53-Photos\ar-1.jpg
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.

Path                       C:\53-Photos\ar-1.jpg
Date Created          09/03/2014 19:50:08
Date Last Accessed  09/03/2014 19:50:08
Date last modified  09/03/2014 19:50:08
Drive                      c:
Parent Folder          C:\53-Photos
Size (Bytes)             66089
Type of File            JPEG Image

C:\scripts>folder folder.vbs
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.

Path               C:\scripts\folder.vbs
Date Created       18/04/2014 00:01:02
Date Last Accessed 18/04/2014 00:01:02
Date last modified 18/04/2014 01:06:49
Drive              C:
Parent Folder      C:\scripts
Size (Bytes)       491
Type of File       VBScript Script File

C:\scripts>

You can try an example to show the file size in MB or GB depending on the size of the file. Or may be list an output like the DIR command.

Tuesday, April 15, 2014

Windows Scripting (the normal shell) for Ex VB Programmers - Lesson 3–Objects

After the basics of variables, Selection and Iteration statements, let us do something useful in real life. We start with the first object FileSystemObject. This gives us access to the filesystem. An essential part of scripting. We may need to create files, modify content, look for their existence. The idea is to make you familiar with using objects as well.

Let us take an example

Set fs = CreateObject("Scripting.FileSystemObject")
Set dc = fs.Drives
For Each d in dc
    wscript.echo d.driveletter
Next

Save this script as fsdrives.vbs

Run it

C:\scripts>cscript fsdrives.vbs //nologo
C
D
F

C:\scripts>

I have three drives on my laptop. Your machine may have more or less. Let us understand the code.

Line 1 is creating an object of FileSystemObject type. Without this you cannot use what is in this object. An object is contains methods (functions) and variables. The variables may be simple variables or may be collections. Collections are more like an array, you can use a for loop to go through each of the items, and then access the properties of each.

fs is an instance of the FileSystemObject

fs.drives is referencing a property of the FileSystemObject

fs.drives returns a collection of drives.

To loop through it we need a for loop. dc is the drive collections we have used. You have a collections of drives. For each drive there are many properties. We are referencing one of the property called driveletter.

Let us make the above program more richer. We not only need the drive, but also want to know the capacity and free space.

' Main Code Starts here

Set fs = CreateObject("Scripting.FileSystemObject")
Set dc = fs.Drives
s=chr(10) & "Number of Drives " & dc.count
wscript.echo s
s=string(65,"-")
wscript.echo s
For Each d in dc
    s=d.driveletter & chr(9) & d.path & chr(9) & d.isready
    if d.isready then
        s=s & chr(9) & d.volumename
        s=s & chr(9) & d.filesystem
        ts=int(int(int(d.totalsize/1024)/1024)/1024) & " GB"
        s=s & chr(9) & ts
          ts=int(int(int(d.freespace/1024)/1024)/1024) & " GB"
        s=s & chr(9) & ts
          ts=int(int(int(d.availablespace/1024)/1024)/1024) & " GB"
        s=s & chr(9) & ts       
    end if
    wscript.echo s
Next

' We have explored, volumename, filesystem, totalsize, freespace
' availablespace, driveletter, path and isready properties from
' the drives collection. These values are for each drive.
' chr(9) is for tab and chr(10) is for new line
' Anything typed after single quote is a comment.
' space is shown in bytes. change to KB, MB, GB by dividing 1024

Copy and paste the code. Run it.

C:\scripts>cscript fsdrives.vbs //nologo

Number of Drives 3
-----------------------------------------------------------------
C       C:      True                  NTFS    421 GB  195 GB  195 GB
D       D:      True    LENOVO  NTFS    28 GB    19 GB    19 GB
F       F:      False

C:\scripts>

That is the output I get. Your challenge would be to fine tune the code further so that the numbers are aligned below each other. On your machine you may see more or less drives and the numbers different.

Monday, April 14, 2014

Windows Scripting (the normal shell) for Ex VB Programmers - Lesson 2–Solution Part 2

Fibonacci Series Solution

wscript.echo "Fibonacci Series"
x=1
y=1
wscript.echo 1
wscript.echo 1
for a=3 to 15
    z=x+y
    x=y
    y=z
    wscript.echo z
next

 

Output

C:\scripts>cscript fibo.vbs //nologo
Fibonacci Series
1
1
2
3
5
8
13
21
34
55
89
144
233
377
610

 

An interesting video on Fibonacci Series can be viewed here.

Sunday, April 13, 2014

Windows Scripting (the normal shell) for Ex VB Programmers - Lesson 2–Solution

The following is the solution of the question in the last post. Printing the prime numbers between 1 and 100. This may not be the best logic, yet it gets what to be done. It is more important to develop a timely solution than an untimely one.

wscript.echo "1"
wscript.echo "2"
wscript.echo "3"
for x=5 to 100 step 2
    isprime=0
    for z=2 to x-1
        if x mod z = 0 then
            isprime=1
        end if
    next
    if isprime=0 then
        wscript.echo x
    end if
next

and the output

C:\scripts>cscript prime.vbs //nologo
1
2
3
5
7
11
13
17
19
23
29
31
37
41
43
47
53
59
61
67
71
73
79
83
89
97

Some more examples that you should try

1. List the Fibonacci series – first 15 numbers

2. Find the Square root of any number correct to 4 decimal places. (use Newton’s method)

Windows Scripting (the normal shell) for Ex VB Programmers - Lesson 2

In any programming language there are three things we need to learn at the earliest.

1. Types of variable

2. Selection Statements

3. Iteration or Loops

Since ours is a “get ready quick” course. We will only try what we think is essential.

1. Variable.

There are no types of variables. What ever you assign the variable takes that values. Unlike in other programming languages you have int, char, fload, date etc. There is nothing here. You can just put any value in any variable. The upside is variable usage is easy. Same variables can be recycled. The downside is explicit conversions are needed everytime a variable of a specific type is needed.

Assume you have a program with the following

i=5
wscript.echo i
i="Programs"
wscript.echo i

When you run it there is no error.

image

 

2. Selection statements.

Keeping it simple.

if <condn> then

<statements>

else

<statements>

randomize
i=int(rnd * 10)
wscript.echo i
if i mod 2 =0 then
    wscript.echo "Even Number"
else
    wscript.echo "Odd Number"
end if

randomize – resets the seed, so that you get a real random numbers all the time. rnd generates a random number between 0 and 0.999xxx. The int function converts the output to an integer (we don’t need the decimals). The mod is a operation to find the remainder.

The above program prints either even or odd depending on the random number. In the example the program is saved as third.vbs

C:\scripts>cscript third.vbs
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.

7
Odd Number

C:\scripts>

C:\scripts>cscript third.vbs
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.

1
Odd Number

C:\scripts>third
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.

0
Even Number

C:\scripts>cscript third.vbs
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.

6
Even Number

C:\scripts>

3. Iteration or Loops

The most convenient loop is the for – next.

An example

wscript.echo "Program 2"
for i=1 to 5
        wscript.echo i
next
wscript.echo "Random Numbers"
for i = 5 to 1 step -1
        randomize
        intnum=rnd
        wscript.echo int(intnum*10)
next

 

A simple program the prints, from 1 to 5. And then random numbers between 0 and 9.

Program 2
1
2
3
4
5
Random Numbers
1
0
8
2
0

Try this exercise.

Print the first 100 prime numbers.

use the concepts learnt.

Friday, April 04, 2014

Windows Scripting (the normal shell) for Ex VB Programmers - Lesson 1

Windows Scripting (the normal shell) for Ex VB Programmers - Lesson 1

Good if you know the old Visual Basic

1. How to write your first script. (lets call this as first.vbs)

1. run cmd.exe

2. create a folder called c:\scripts

3. run notepad first.vbs

clip_image002

4. Save and run this file as follows

clip_image004

5. Try to run the file without using cscript and see what you get

clip_image006

6. This is because by default vbs files are executed using wscript

7. what if you wanted to change the default. Do the following

clip_image008

8. What if you wanted to change back the default to wscript

wscript //H:wscript

-----------------------------------------------------------------end of lesson

Monday, December 23, 2013

Even Browsers can give your location

Yes. If you are on facebook, or for the matter on any web site,  and worry about your privacy, which you should then what to do?.

The first thing that you can or should do is, disable your location. Let your browser not know your location. How do get this done on three main browsers.

1. Firefox. (works on Ver 26)

a. Open a window and type about:config

b. Agree to the warning.

c. Search for geo.enabled and Set it as false. Look in the image.

Capture

2. Google Chrome

a. Open a windows and type chrome://settings

b. Click on Advanced Settings

Capture

c. Under Privacy click on “Content Settings”

capture1

d. Scroll down and choose “Location Setting” and select

capture2

3. Internet Explorer

a. goto Tools->Internet Options

capture3

Select the “Privacy Tab”

And check the box as shown above.

 

And now surf the internet atleast not worrying about your location is tracked. What next?

Monday, December 09, 2013

Lessons : The honest truth about dishonesty.

On my recent travel I read this book. Very relevant and lots of research gone into it.

 

the-honest-truth_custom-c49190bb951aaea5899bd2a2798bc6c887827751-s6-c30

You can click on the book to goto Amazon.

Dishonesty, that we hardly think about in our daily lives is sometimes very subtle. I look back and find that in my life as well there are cases where it can be seen. For instance taking more than an hour for lunch, or sometimes taking a long tea break. Also the research done in the book gives insights on how we can ensure practices that can reduce dishonesty in our work place.

A worth read.

Monday, November 18, 2013

Cloud Storage. What to look for.

Every one talks cloud. Let us look at Cloud Storage. What it means? You store your data at a third party place. Why? May be lower cost, administration simplification, security, protection etc. All these things encourage us.

Where are the risks? Like all business a cloud business can fail too. What if your cloud company is the single point of failure. What happens then?

a. Your data sits on the cloud. Your cloud provider closes shop. Do you have enough time to get it back? Even you have that time, do you have enough space to get it back. Even if you can get it back will the provider have enough bandwidth for all those who want their data?

b. Suppose you got back the data, you also somehow managed to secure some storage, will your applications work? Who will make changed to them? Can you keep your RPO?

So then what is the solution? May be in a next post.

Tuesday, July 02, 2013

Bye Bye Altavista

Come 8th July and another search engine altavista is going to leave cyberspace. Altavista has been one of the first search engines, indexing millions of pages. It was a product that too ahead of its time. Some how through companies buying each other, it came with Yahoo. Now Yahoo has decided to stop this product.

Surprising but in my two decades in IT I have started to see even good products reaching their end of life. Have a look at this page as of today.

Capture

From 8th July the domain name www.altavista.com will redirect to yahoo.com.

Source : BBC

Sunday, June 30, 2013

Google Reader

After all the requests, signatures, announcements, one of the very good service from Google, the Google Reader will be retiring tonight. When I logged in today I got this message,

google_reader

Felt sad to see this. I had been a regular of this since many years. So finally I logged in today and deleted all my feeds. Make the life of Google a bit easier.

Capture

I hope Google changes its mind. And hope that other of my favorite services like GMail, Search Engine, Google Maps, Google Earth, Google Documents also do not face the same fate as the Reader.

Saturday, June 29, 2013

Get Start Button in Windows 8

One of the notably sad omission in windows 8 is the start button. The 8.1 version had lots of promise. Bloggers got greatly impressed with it when they saw the preview. The actual working was never published. What happened when 8.1 was released? The magical start button never came. The one put is practically of no use.

So how do we get the start button back. A genuine start button. One that works the same way it worked in Windows 7 and earlier versions. The best and free among the pack is Classic Shell.

So what happens after you install the Classic Shell. It should look something like this.

start

Where do you download it from?

a. From here

A normal setup.exe, next, next, finish. And you have the shell.

A thanks to the developers of classic shell.

Get back productive, and get back fast.

Monday, March 04, 2013

Allway sync

The amount of data that we are storing is on the rise. A normal household owning a computer easily has a TB of data. You just add up the hard disks, USB sticks, DVDs and CDs. Loss of data can mean a great loss.

What is the easiest way to sync your data. Say for instance you want to sync your internal disk to an external USB hard disk.

Of the many software one I like is AllwaySync. Easy to use. Download and within minutes you are on the go.

Some pieces of advice.

1. Keep your hard disk organized. I mean decide a directory structure and maintain it. For instance you can have folders like the following that I have on my disk.

image

I always like to begin with numbers. That way the organization is well and easy to understand. Alphabetical order is just a waste.

2. Keep the same structure on all your hard disks. So you need to thus create one plan

image

3. Keep atleast sync to two USB disks. This way you keep three copies. One on your local hard drive, two external copies. Sync them say every Friday. Since they have the same structure, It is just a single click.

 

So next time there should be no way to lose data.

Happy Syncing.

Tuesday, December 25, 2012

Firefox.

Firefox has taken the browsing wars by storm. It has been very successful. Browsers are no more browsers and are never complete without the extensions. In the next series of posts (it is vacation time), I will try to help make your web experience secure. Assuming here the installation is on Windows (Desktop). I will try to cover other OS later.

1. First stage is of course you need to install Firefox. 

Click here to download. Run the EXE file and select the default options and complete the installation. Run Firefox and make it as your default browser if you are asked for it. And then get these extensions.

2. How do download the extensions?

image

I have installed the wallnut theme. Never mind if your browser does not look the same.

3. In the list you see, select Extensions from the left. Your list should be empty. The Extensions that we need are listed here.

image

4. We start with the list. Adblock Plus. This was the original adblock software. You can read more about it here.

So what are the visible effects after you install this extension?

image

When you click on the circle on the lower left in your browser, you see filter subscriptions. The first item is already added by default. What you need is the other next 4 in the list that I have added.

image

Uncheck this box, to make the filter complete.

 

Next extension tomorrow.

“Take care on social networks”

For those who are using Facebook (or any other social networking site) there are some precautions that you can take. I have listed a few.

1. All you post on Facebook is public. So please be careful on what you are posting. Try to enter your name in google.com search box, and it will bring out so many surprises. When you apply for job or admission to university, or offer your services anywhere, your future employer or manager can always check this information.

2. What you post on your wall or your friends wall stays there forever. So before posting double and triple check on what you write. Do not post anything that you are not sure of, that you have not verified, or that you have no document to prove it is right or wrong.

3. Many applications and games that you play, ask you for your permission. Please read the details carefully. It may be taking your personal information, your friends list, your pictures etc.

4. What information you don’t like don’t post. For example information like date of birth, phone numbers, company names, family names (brothers, sisters, and parents), place of birth etc is considered personal. Think twice before you put them.

5. Limit the time you spend on social networking sites. You can save time and use it for better purposes.

6. Posting Photos. When you post photos be sure that either you are the owner of the photo or you have taken permission from the photographer or the photo is already in public domain. Internet may look like it is public, but those are in network administration can tell you everything that we do (login, logout, machine, etc all information is logged).

7. Give credit to what you take. If you taken a quote from somewhere or you have taken an article from somewhere, it is always good to mention the source. Give credit.

Let us have a safe and productive surfing.

Suresh Ranga

30.01.2011

 

 

* I posted this on one of the Facebook groups that I was an admin almost 2 years back. Thought would be helpful.

Tuesday, October 09, 2012

PDF Books from Wikipedia

Wikipedia is just brilliant.

One of the great features of this site, I liked was, the ability of combine a few pages of our interest and convert it to a PDF file. This can be used for either

  • later reading
  • sending to customer.

This blog post is showing how to create a PDF of some of our like minded pages. Let us say we need to create a PDF of some information on Storage Area Networking, Fibre Channel and SCSI.

Step 1.

1. Goto the page of Storage Are Networking

image

2. Choose Create a Book

image

3. Start Book Creator

image

5. Goto the next page on Fibre Channel Protocol

image

6. Add this page also.

7. Goto the SCSI page and add it as well. You should now be able to see 3 pages.

 image

8. Click on Show Book, and on the next screen enter the title.

image

9. On the right click on download

image

image

10. There are many formats to choose from. Let us say you choose PDF and Download.

image

Ultimately, you get a Download link. (Press F5 to refresh)

The book is ready a PDF file.

image

----------------------------------------------------------------------------

MD5

MD5 is or message digest 5, is a cryptographic algorithm to generate the hash value (say of a file). It generates a 16 byte or 128 bit value. Often it is used to check the integrity of downloads. Once you download a file, how sure are you that what you have downloaded is what the file is supposed to be.

For instance, let us say you are downloading Ubuntu. At the page you can see the file and know what is the md5. Once your download completes, you should get some utility to check the md5. If the strings match, you are sure that you downloaded what you want. This is useful in cases where there are mirror sites, that allow for download files in local regions. From the main site you get the MD5 checksum (string), and once you have downloaded the file, you run a local MD5 generation program on the downloaded file and compare.

So how do we generate MD5. There are plenty of utilities available. There is one from Microsoft itself. You can download it from this KB Article. Download and run the file. Instructions are here.

Run the program to calculate the checksum, like this.

image

The md5 of the downloaded file, calculated by fciv utility from Microsoft. The original value of iso I got from the web site.

image

That guarantees that I got the file right.

 

Sources.

1. http://en.wikipedia.org/wiki/MD5

2.http://support.microsoft.com/kb/841290

Friday, September 14, 2012

Random Characters Folder Deletion (Windows 7)

After a windows update it not un-usual to see a folder with random characters. This folder cannot be deleted with regular deletion. For example, there is this folder with random characters after an update.

image

I try to delete the folder and get the message.

image

How to go about deleting the folder. The process is to change the permission and try the deletion.

1. Right click the folder, Select Properties.

image

2. Select Advanced, Owner Tab, Edit, and change the owner to Administrator. Check the check box to ensure everything inside the folder changes as well. Confirm with OK button.

image

3. Goto Command Line (cmd.exe and run as administrator) and get the ACLs on the folder

image

image

Brief explanation what the command is doing.

a. cacls is for changing permissions (access control lists). In Windows 7 it is replaced with icacls.

b. This command has been since Windows NT days and is a convenient way to modify ACL’s of a large number of folders. (Alternative would be to go via Windows Explorer)

c. /t is for replacing the permissions.

d. /g is to grant permission, with :F meaning full control.

e. /f will give a “Yes” by default. else you need to answer the question “Are you sure (y/n)”

 

So there you are. You can now go and delete the folder.