Alex_Piggy
Advanced Member | Редактировать | Профиль | Сообщение | ICQ | Цитировать | Сообщить модератору Код: ' 2>nul & set "filename=test.exe" ' 2>nul & cscript //nologo /E:vbscript "%~f0" "%~dp0%filename%" & exit Const SW_SHOWDEFAULT = 10 Const HKEY_CURRENT_USER = &H80000001 Set WshShell = CreateObject("WScript.Shell") Set FSO = CreateObject("Scripting.FileSystemObject") Set REG = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv") If Wscript.Arguments.Count=0 then Wscript.Echo "Please use filename as argument" Wscript.Quit 1 End If filename=FSO.GetAbsolutePathName(Wscript.Arguments.Item(0)) If Wscript.Arguments.Count>1 then for i=1 to Wscript.Arguments.Count-1 arguments=arguments & " " & Wscript.Arguments.Item(i) next End If If Not FSO.FileExists(filename) then Wscript.Echo "File """ & filename & """ isn't exist" Wscript.Quit 1 End If workdir=FSO.GetParentFolderName(filename) shortcut = FSO.GetAbsolutePathName(FSO.BuildPath(FSO.GetParentFolderName(workdir),FSO.GetBaseName(Filename))& ".lnk") compatibility = "WINXPSP2 256COLOR DISABLETHEMES DISABLEDWM" With WshShell.CreateShortcut(shortcut) .Arguments = arguments .WindowStyle = SW_SHOWDEFAULT .TargetPath = filename .HotKey = "Ctrl+Alt+L" .IconLocation = "shell32.dll,1" .Description = "описАние" .WorkingDirectory = workdir .Save End With REG.CreateKey HKEY_CURRENT_USER, "Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" REG.SetStringValue HKEY_CURRENT_USER, "Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers", filename, compatibility Set FSO = Nothing Set WSC = Nothing Set REG = Nothing | |