---
title: "WScript 对记事本的操作"
author: "tof.j"
date: "2008-10-18T12:52:11Z"
tags: []
slug: "wscript"
draft: false
lastmod: "2008-10-18T12:52:11Z"
id: 254667
url: "https://tof-j.iteye.com/blog/254667"
---

var WshShell = new ActiveXObject("WScript.Shell");  
WshShell.Run("Notepad");  
//WScript.Sleep(100);  
WshShell.AppActivate("Notepad");  
//WScript.Sleep(100);  
WshShell.SendKeys("Hello World!{ENTER}");  
//WScript.Sleep(500);  
WshShell.SendKeys("^s");  
//WScript.Sleep(500);  
WshShell.SendKeys("c:\\\\savedWorld.txt");  
//WScript.Sleep(500);  
WshShell.SendKeys("{Enter}");  
WshShell.SendKeys("%{F4}");