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

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.

主站蜘蛛池模板: 电白县| 仁寿县| 香河县| 阿勒泰市| 屏东市| 青岛市| 马关县| 九江市| 玉门市| 东城区| 云浮市| 清原| 通化市| 壤塘县| 禄丰县| 肇源县| 含山县| 恩施市| 日喀则市| 霍城县| 宝山区| 抚州市| 确山县| 张家川| 确山县| 玉环县| 额济纳旗| 青阳县| 芜湖县| 买车| 玛沁县| 府谷县| 澳门| 云安县| 集贤县| 军事| 正安县| 铜鼓县| 民丰县| 西平县| 柳州市|