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

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.

主站蜘蛛池模板: 常山县| 额敏县| 涞源县| 本溪市| 二手房| 荆州市| 七台河市| 大连市| 泸水县| 吴川市| 文成县| 鹿泉市| 莱芜市| 林芝县| 建湖县| 综艺| 龙江县| 丰顺县| 高阳县| 周宁县| 北流市| 大名县| 兴化市| 临湘市| 桂东县| 长治市| 柳州市| 龙州县| 吉木乃县| 黔南| 报价| 天祝| 志丹县| 乐都县| 西城区| 山丹县| 廊坊市| 苗栗县| 师宗县| 南漳县| 仁布县|