VBScript関連
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
] [
Twitter
]
開始行:
→PowerShell他
#contents
-[[「VBScript」は非推奨に、将来のWindowsリリースで削除 - ...
-[[VBScriptを使ってActiveDirectoryのユーザ情報を参照する ...
-[[客先常駐の仕事で1%も出てこないけど知っとくとそれなりに...
--VBA/WSHでIE制御
--TeraTermマクロ
--HTTPSの閲覧制限を突破
--PCの管理者権限を得ずにインストールせずにmsiの中身をとり...
-VBScriptでクリップボードへコピー
Public Sub PutInClipboardText(ByVal str)
Dim cmd
cmd = "cmd /c ""echo " & str & "| clip"""
CreateObject("WScript.Shell").Run cmd, 0
End Sub
-[[Windowsバッチで,パソコンのCPUの温度をモニタリングしよ...
-[[DynaCall>http://freenet-homepage.de/gborn/WSHBazaar/WS...
--VBScriptからWinAPIを呼びたいときに使うコンポーネント
-[[WSHからメール送信するときのメモ>http://muumoo.jp/news/...
-右クリックから出るポップアップメニューでファイルのフルパ...
dim args
dim toClip
dim drive
dim path
On Error Resume Next
If WScript.Arguments.Count = 0 Then
Dim objWshShell
Set objWshShell = WScript.CreateObject("WScript.Shell")
If Err.Number = 0 Then
objWshShell.RegRead("HKCR\Folder\shell\fullpathcopy\")
If Err.Number = 0 Then
objWshShell.RegDelete "HKCR\Folder\shell\fullpathc...
objWshShell.RegDelete "HKCR\Folder\shell\fullpathc...
objWshShell.RegDelete "HKCR\*\shell\fullpathcopy\c...
objWshShell.RegDelete "HKCR\*\shell\fullpathcopy\"
WScript.Echo "右クリックメニューから削除しました。"
Else
Dim scriptPath
scriptPath = "WScript.exe """ & WScript.ScriptFull...
objWshShell.RegWrite "HKCR\Folder\shell\fullpathco...
objWshShell.RegWrite "HKCR\Folder\shell\fullpathco...
objWshShell.RegWrite "HKCR\*\shell\fullpathcopy\",...
objWshShell.RegWrite "HKCR\*\shell\fullpathcopy\co...
WScript.Echo "右クリックメニューに登録しました。"
End If
Else
WScript.Echo "エラー: " & Err.Description
End If
Set objWshShell = Nothing
Else
args = WScript.Arguments.Item(0)
drive = Left(args, 2)
path = Right(args, Len(args) - 2)
drive = ChangeNetworkDrive(drive)
toClip = drive & path
ClipSet(toClip)
End If
On Error Goto 0
Sub ClipSet(TextData)
Dim FF
Dim TB
Set FF = CreateObject("Forms.Form.1")
If IsEmpty(FF) Then
Exit Sub
End If
Set TB = FF.Controls.Add("Forms.TextBox.1").Object
TB.MultiLine = True
TB.Text = TextData
TB.SelStart = 0
TB.SelLength = TB.TextLength
TB.Copy
Set TB = Nothing
Set FF = Nothing
End Sub
Function ChangeNetworkDrive(src)
Dim objWshNetwork ' WshNetwork オブジェクト
Dim objDrives ' ドライブ情報
Dim lngLoop ' ループカウンタ
Set objWshNetwork = WScript.CreateObject("WScript.Netw...
If Err.Number = 0 Then
Set objDrives = objWshNetwork.EnumNetworkDrives
If Err.Number = 0 Then
If objDrives.Count > 0 Then
For lngLoop = 0 To objDrives.Count - 1 Step 2
If src = objDrives.Item(lngLoop) Then
ChangeNetworkDrive = objDrives.Item(lngLoop ...
Set objWshNetwork = Nothing
Exit Function
End If
Next
End If
End If
End If
ChangeNetworkDrive = src
Set objWshNetwork = Nothing
End Function
終了行:
→PowerShell他
#contents
-[[「VBScript」は非推奨に、将来のWindowsリリースで削除 - ...
-[[VBScriptを使ってActiveDirectoryのユーザ情報を参照する ...
-[[客先常駐の仕事で1%も出てこないけど知っとくとそれなりに...
--VBA/WSHでIE制御
--TeraTermマクロ
--HTTPSの閲覧制限を突破
--PCの管理者権限を得ずにインストールせずにmsiの中身をとり...
-VBScriptでクリップボードへコピー
Public Sub PutInClipboardText(ByVal str)
Dim cmd
cmd = "cmd /c ""echo " & str & "| clip"""
CreateObject("WScript.Shell").Run cmd, 0
End Sub
-[[Windowsバッチで,パソコンのCPUの温度をモニタリングしよ...
-[[DynaCall>http://freenet-homepage.de/gborn/WSHBazaar/WS...
--VBScriptからWinAPIを呼びたいときに使うコンポーネント
-[[WSHからメール送信するときのメモ>http://muumoo.jp/news/...
-右クリックから出るポップアップメニューでファイルのフルパ...
dim args
dim toClip
dim drive
dim path
On Error Resume Next
If WScript.Arguments.Count = 0 Then
Dim objWshShell
Set objWshShell = WScript.CreateObject("WScript.Shell")
If Err.Number = 0 Then
objWshShell.RegRead("HKCR\Folder\shell\fullpathcopy\")
If Err.Number = 0 Then
objWshShell.RegDelete "HKCR\Folder\shell\fullpathc...
objWshShell.RegDelete "HKCR\Folder\shell\fullpathc...
objWshShell.RegDelete "HKCR\*\shell\fullpathcopy\c...
objWshShell.RegDelete "HKCR\*\shell\fullpathcopy\"
WScript.Echo "右クリックメニューから削除しました。"
Else
Dim scriptPath
scriptPath = "WScript.exe """ & WScript.ScriptFull...
objWshShell.RegWrite "HKCR\Folder\shell\fullpathco...
objWshShell.RegWrite "HKCR\Folder\shell\fullpathco...
objWshShell.RegWrite "HKCR\*\shell\fullpathcopy\",...
objWshShell.RegWrite "HKCR\*\shell\fullpathcopy\co...
WScript.Echo "右クリックメニューに登録しました。"
End If
Else
WScript.Echo "エラー: " & Err.Description
End If
Set objWshShell = Nothing
Else
args = WScript.Arguments.Item(0)
drive = Left(args, 2)
path = Right(args, Len(args) - 2)
drive = ChangeNetworkDrive(drive)
toClip = drive & path
ClipSet(toClip)
End If
On Error Goto 0
Sub ClipSet(TextData)
Dim FF
Dim TB
Set FF = CreateObject("Forms.Form.1")
If IsEmpty(FF) Then
Exit Sub
End If
Set TB = FF.Controls.Add("Forms.TextBox.1").Object
TB.MultiLine = True
TB.Text = TextData
TB.SelStart = 0
TB.SelLength = TB.TextLength
TB.Copy
Set TB = Nothing
Set FF = Nothing
End Sub
Function ChangeNetworkDrive(src)
Dim objWshNetwork ' WshNetwork オブジェクト
Dim objDrives ' ドライブ情報
Dim lngLoop ' ループカウンタ
Set objWshNetwork = WScript.CreateObject("WScript.Netw...
If Err.Number = 0 Then
Set objDrives = objWshNetwork.EnumNetworkDrives
If Err.Number = 0 Then
If objDrives.Count > 0 Then
For lngLoop = 0 To objDrives.Count - 1 Step 2
If src = objDrives.Item(lngLoop) Then
ChangeNetworkDrive = objDrives.Item(lngLoop ...
Set objWshNetwork = Nothing
Exit Function
End If
Next
End If
End If
End If
ChangeNetworkDrive = src
Set objWshNetwork = Nothing
End Function
ページ名: