官术网_书友最值得收藏!

Making a directory and creating a file from Command Prompt

Now, you want to make sure that you have the samplefile.txt file. So, to do that in Windows, type cmd, which is short for Command Prompt, and open that. At the C:\> prompt, start by typing cd.. to go up one level and then cd.. again to go up another level. Then enter cd data to change to the data directory. The system responds that this path does not exist, as you can see in Figure 5.5.3; so, we'll have to create the path and make the file:

Figure 5.5.3: The system indicates that the path c:\>data does not exist

To create the path, type the following at command prompt:

C:\>md data

Then, enter the following to change into that directory:

C:\>cd data

Next, type the following to show you the list of files in the directory:

C:\data\dir

As you can see in the Figure 5.5.3, there is nothing inside the directory: it's new, we just created it. So, to open a file in Notepad, type the following at the prompt:

C:\data\notepad.exe samplefile.txt

This makes the file. When the screen prompt asks if you want to create a new file, click on the Yes button. This will open a blank Notepad file. Enter some text, as shown in Figure 5.5.4:

Figure 5.5.4: Enter some text in the new Notepad file you created

Make sure that you save it in the C:\data directory (Ctrl + S) and then you can close it.

Now, take a look. To recall previous commands, you can just press the up arrow key or, in this case, type dir at command prompt as earlier: C:\data\dir. Now you can see that samplefile.txt is present in the directory, as shown in Figure 5.5.5:

Figure 5.5.5: samplefile.txt is now present in the directory

Now launch this in your browser, and take a look at the results. Click on the Show button. It's working as expected: it opened both the Notepad file and the Bing home page, as shown in Figure 5.5.6:

Figure 5.5.6: The Notepad file and http://www.bing.com are opened with our program

You can now launch any browser, a process of some kind, directly from your page and show it and you can open up a file, if you want, directly from a browser.

Note that this works because we are running the page from our local web server and thus we have access to Notepad and the browser. In a real internet application, things would be different.

Also, you can see the listing of the keys, as shown in Figure 5.5.7:

Figure 5.5.7: The listing of the keys

So, these are some of the basics of what you can do with a generic dictionary.

主站蜘蛛池模板: 襄垣县| 中宁县| 平利县| 华阴市| 济宁市| 西城区| 安化县| 奉节县| 大化| 洛南县| 彰化县| 繁昌县| 喜德县| 岫岩| 体育| 社会| 合水县| 敖汉旗| 通州区| 库尔勒市| 彰武县| 尉犁县| 册亨县| 会宁县| 鹰潭市| 宁晋县| 思南县| 江都市| 沁源县| 恩平市| 慈利县| 赤峰市| 永宁县| 扶沟县| 海盐县| 波密县| 莒南县| 武强县| 沂南县| 漳浦县| 隆林|