1
00:00:00,840 --> 00:00:05,570
Navigating a PowerShell session is no different than navigating a DOS window

2
00:00:05,570 --> 00:00:09,290
or CMD window that you hopefully have done in the past.

3
00:00:09,290 --> 00:00:12,540
You can use really the same commands to get started.

4
00:00:12,540 --> 00:00:15,810
So let's say I want to change directory to the Windows folder.

5
00:00:15,810 --> 00:00:20,050
I can do cd, for change directory, and then the path to the folder

6
00:00:20,050 --> 00:00:23,340
that I want to change to, and then press Enter.

7
00:00:23,340 --> 00:00:25,290
You can see the prompt changes.

8
00:00:25,290 --> 00:00:28,210
I can type the dir command to get a list of all the files in that

9
00:00:28,210 --> 00:00:31,860
directory. If I want just the executable files, I can say, hey,

10
00:00:31,860 --> 00:00:38,510
give me the directory listing of *.exe. Let's go ahead and change

11
00:00:38,510 --> 00:00:43,340
to an environmental variable to the %appdata directory. Now in

12
00:00:43,340 --> 00:00:46,340
PowerShell, you're going to type it like this. So I'm going to do

13
00:00:46,340 --> 00:00:51,440
cd and then $env:appdata.

14
00:00:51,440 --> 00:00:54,060
Now the $env is a way of telling PowerShell to use

15
00:00:54,060 --> 00:00:56,740
the environmental variable AppData.

16
00:00:56,740 --> 00:01:01,210
Again, I know I'm showing you some things that you probably haven't learned yet,

17
00:01:01,210 --> 00:01:04,250
so just kind of follow along in the demo file.

18
00:01:04,250 --> 00:01:08,850
Eventually, you'll understand exactly what you're typing

19
00:01:08,850 --> 00:01:12,240
and why it works the way that it does.

20
00:01:12,240 --> 00:01:18,590
So now I'm in the AppData variable for my artd user.

21
00:01:18,590 --> 00:01:21,640
And again, I can do a directory listing.

22
00:01:21,640 --> 00:01:24,190
Now, if you're from the CMD world,

23
00:01:24,190 --> 00:01:27,310
you may be thinking, know what, I want to look in that Microsoft

24
00:01:27,310 --> 00:01:31,630
directory and I want to search all these subdirectories. So you'll

25
00:01:31,630 --> 00:01:35,380
type a command like this, and that fails.

26
00:01:35,380 --> 00:01:37,260
Now don't worry about the error message other than the

27
00:01:37,260 --> 00:01:40,640
fact that you know that it did not work.

28
00:01:40,640 --> 00:01:43,560
What you need to know for just right now is that even

29
00:01:43,560 --> 00:01:45,810
though we're using the dir command,

30
00:01:45,810 --> 00:01:48,960
technically what we're using is an alias for a

31
00:01:48,960 --> 00:01:52,780
PowerShell command that does the same thing.

32
00:01:52,780 --> 00:01:56,140
The command that we're running in PowerShell, this dir

33
00:01:56,140 --> 00:01:59,840
command, doesn't understand what /s is.

34
00:01:59,840 --> 00:02:04,640
Eventually you will learn about how to get help for these PowerShell commands.

35
00:02:04,640 --> 00:02:08,770
For now, let me just let you know that instead of using /s,

36
00:02:08,770 --> 00:02:13,750
you will use ‑Recurse. And this will go through, and now I get that recursion

37
00:02:13,750 --> 00:02:18,560
that I was looking for. I can do similar things saying,

38
00:02:18,560 --> 00:02:18,770
hey,

39
00:02:18,770 --> 00:02:24,240
I want to search in that Microsoft directory for all my link files recursively,

40
00:02:24,240 --> 00:02:27,140
and you can see that that all works.

41
00:02:27,140 --> 00:02:30,280
I can go back to the root of C,

42
00:02:30,280 --> 00:02:35,690
and I can use cls, or clear host, to clear the screen.

43
00:02:35,690 --> 00:02:39,040
Other things that we used to do in this DOS world, the cmd world,

44
00:02:39,040 --> 00:02:44,570
still work also here in PowerShell. If I want I can just echo some

45
00:02:44,570 --> 00:02:47,080
text to the screen, like Hello, World.

46
00:02:47,080 --> 00:02:50,590
I can direct that text to a text file.

47
00:02:50,590 --> 00:02:55,650
Now here I'm using the legacy operators, that angle brackets,

48
00:02:55,650 --> 00:02:58,050
which is the redirection character,

49
00:02:58,050 --> 00:03:01,380
and I'm redirecting it to the documents folder to a file called

50
00:03:01,380 --> 00:03:04,790
hello.txt. That little squiggle there you see in front of documents,

51
00:03:04,790 --> 00:03:09,200
that's a legacy shell shortcut that PowerShell knows,

52
00:03:09,200 --> 00:03:12,840
just like the DOS shell does, the CMD shell knows, it knows

53
00:03:12,840 --> 00:03:16,590
where your documents folder is. And if I want,

54
00:03:16,590 --> 00:03:21,170
I can also append information to it using the double angle brackets,

55
00:03:21,170 --> 00:03:27,420
that's the legacy DOS APPEND operator, it works fine here in PowerShell.

56
00:03:27,420 --> 00:03:32,890
And to do a directory listing, so there it is,

57
00:03:32,890 --> 00:03:37,320
that little squiggle there resolved to C:\Users\artd. I didn't have

58
00:03:37,320 --> 00:03:40,440
to try to remember who I was or the path to that.

59
00:03:40,440 --> 00:03:43,340
That's a nice little shortcut there.

60
00:03:43,340 --> 00:03:47,150
And, of course, I can also use, again, DOS type commands to say,

61
00:03:47,150 --> 00:03:47,290
hey,

62
00:03:47,290 --> 00:03:52,900
show me the contents of that text file. Let's clear the

63
00:03:52,900 --> 00:03:55,470
screen here. Let's make a directory.

64
00:03:55,470 --> 00:04:00,540
Let's make a work folder. In the DOS world we used the mkdir command.

65
00:04:00,540 --> 00:04:01,120
You know what?

66
00:04:01,120 --> 00:04:06,640
I can use that also here in PowerShell. So I just created the work folder.

67
00:04:06,640 --> 00:04:11,980
Let's copy a file, let's copy a Notepad, and let's copy it to the

68
00:04:11,980 --> 00:04:16,560
work folder. And take a look, and sure enough,

69
00:04:16,560 --> 00:04:18,440
there it is.

70
00:04:18,440 --> 00:04:24,370
If I wanted to, I can also delete that file.

71
00:04:24,370 --> 00:04:31,140
And if we verify that, you can see that that executable is now gone.

72
00:04:31,140 --> 00:04:34,350
And if I really am done here, I can even remove the directory again,

73
00:04:34,350 --> 00:04:39,640
just like we did in the DOS world.

74
00:04:39,640 --> 00:04:44,240
And now you can see that the work folder is missing.

75
00:04:44,240 --> 00:04:49,880
I can launch applications from PowerShell just like I can from any other

76
00:04:49,880 --> 00:04:53,850
session, any other window like in DOS or the CMD window.

77
00:04:53,850 --> 00:05:02,640
I can type Notepad. I could type calc, and there I get the Windows calculator,

78
00:05:02,640 --> 00:05:05,570
although what's really cool here is that I can do

79
00:05:05,570 --> 00:05:07,580
math in the PowerShell session.

80
00:05:07,580 --> 00:05:18,990
I can do 2+7+1, or 15*2, 25/5, or something like that.

81
00:05:18,990 --> 00:05:25,180
Navigating and working in the PowerShell shell is really not that difficult.

82
00:05:25,180 --> 00:05:34,000
When you're done, you can either just close with the X or you can type exit, and that will exit the shell.

