Last active
February 10, 2017 22:33
-
-
Save hymkor/28528879b8f240185145 to your computer and use it in GitHub Desktop.
(単体で動作する) sendto 管理バッチ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@if (0) == (0) echo off | |
cscript //nologo /E:JScript "%~f0" Sendto %* | |
exit /b 0 | |
@end | |
var objShell = new ActiveXObject("WScript.Shell"); | |
var sendto = objShell.SpecialFolders(WScript.Arguments.Item(0)) | |
if( WScript.Arguments.length <= 1 ){ | |
var shellApp=new ActiveXObject("Shell.Application"); | |
shellApp.ShellExecute(sendto,"","","open"); | |
WScript.Quit(0); | |
} | |
var fsObj = new ActiveXObject("Scripting.FileSystemObject"); | |
for(var i=1 ; i < WScript.Arguments.length ; i++ ){ | |
var itm = WScript.Arguments.Item(i); | |
var src = fsObj.GetAbsolutePathName(itm); | |
var dst = fsObj.BuildPath(sendto,fsObj.GetFileName(itm) + ".lnk"); | |
WScript.Echo(" " + src + "\n--> " + dst); | |
var shortcut = objShell.CreateShortcut(dst); | |
shortcut.TargetPath = src; | |
shortcut.Save(); | |
} | |
// vim:set ft=javascript: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cscript //nologo /E:JScript "%~dp0sendto.cmd" Startup %* | |
exit /b 0 |
Author
hymkor
commented
Jul 17, 2015
- SpecialFolder名を引数で取るようにした(これで、他のバッチからスタートアップなども同様に使うことができる)
- 本コマンド自体の仕様は変更なし
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment