Option Explicit '変数は宣言が必要
Dim FileSystem
Set FileSystem = CreateObject("Scripting.FileSystemObject")
FileSystem.CopyFile "Srcfile","Dstfile"
FileSystem.MoveFile "Srcfile","Dstfile"
FileSystem.DeleteFile "Tgtfile"
|
Option Explicit '変数は宣言が必要
Dim WshShell
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "NOTEPAD.EXE" 'メモ帳の起動
WshShell.Run "MSPAINT.EXE" 'ペイントの起動
|
Option Explicit '変数は宣言が必要
Dim WshShell
Dim Msg
Set WshShell = CreateObject("WScript.Shell")
On Error Resume Next
Msg = "Registry Error"
Msg = WshShell.RegRead("HKCR\.txt\")
Wscript.Echo Msg
|
Option Explicit '変数は宣言が必要
Dim WshShellEnv
Set WshShellEnv = CreateObject("WScript.Shell").Environment("Process")
WScript.Echo WshShellEnv("PATH")
WshShellEnv("TEST_PATH") = WshShellEnv("PATH") + ";C:\USR\TOOL"
WScript.Echo WshShellEnv("TEST_PATH")
|
Option Explicit '変数は宣言が必要
Dim WshShell
Dim iCnt
Set WshShell = CreateObject("WScript.Shell")
For iCnt = 1 to 10
WshShell.Run "NOTEPAD.EXE" 'メモ帳の起動
Next |
Option Explicit '変数は宣言が必要 WScript.Echo Wscript.Name & " Version " & Wscript.Version |
Option Explicit '変数は宣言が必要
Dim WshShell
Dim EW
Set WshShell = CreateObject("WScript.Shell")
'スキャンディスクの実行
WshShell.Run "SCANDSKW/all/n",SW_SHOW,TRUE
'デフラグの実行
WshShell.Run "DEFRAG/all/f/noprompt",SW_SHOW,TRUE
'電源のオフ(自作のOCX)
Set EW = CreateObject("WinBatch.ExitWin") 'Windowsの終了
EW.flag = 5 '電源オフ
Call EW.ExitWin
|
// ExitWin.cpp : CExitWin のインプリメンテーション
#include "stdafx.h"
#include "WinBatch.h"
#include "ExitWin.h"
/////////////////////////////////////////////////////////////////////////////
// CExitWin
STDMETHODIMP CExitWin::get_flag(long *pVal)
{
// TODO: この位置にインプリメント用のコードを追加してください
*pVal = m_flag;
return S_OK;
}
STDMETHODIMP CExitWin::put_flag(long newVal)
{
// TODO: この位置にインプリメント用のコードを追加してください
m_flag = newVal;
return S_OK;
}
STDMETHODIMP CExitWin::ExitWin()
{
// TODO: この位置にインプリメント用のコードを追加してください
::ExitWindowsEx(m_flag, 0);
return S_OK;
}
|