hctshortcut.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // //
  3. // hctshortcut.js //
  4. // Copyright (C) Microsoft Corporation. All rights reserved. //
  5. // This file is distributed under the University of Illinois Open Source //
  6. // License. See LICENSE.TXT for details. //
  7. // //
  8. ///////////////////////////////////////////////////////////////////////////////
  9. //
  10. // Use this script to create a shortcut on your desktop that will set up the
  11. // right console environment.
  12. //
  13. var shell = WScript.CreateObject("WScript.Shell");
  14. var linkName = "HLSL console";
  15. var hctPath = WScript.ScriptFullName;
  16. hctPath = hctPath.substr(0, hctPath.lastIndexOf("\\"));
  17. var hctStartPath = hctPath + "\\hctstart.cmd";
  18. var srcPath = hctPath; // root\utils\hct
  19. srcPath = srcPath.substr(0, srcPath.lastIndexOf("\\")); // root\utils
  20. srcPath = srcPath.substr(0, srcPath.lastIndexOf("\\")); // root
  21. var binPath = srcPath; // somewhere\root
  22. binPath = srcPath.substr(0, srcPath.lastIndexOf("\\")); // somewhere\
  23. binPath = binPath + "\\hlsl.bin";
  24. var desktopPath = shell.SpecialFolders("Desktop");
  25. var shortcut = shell.CreateShortcut(desktopPath + "\\" + linkName + ".lnk");
  26. shortcut.TargetPath = shell.ExpandEnvironmentStrings("%windir%\\System32\\cmd.exe");
  27. shortcut.Arguments = "/k " + hctStartPath + " " + srcPath + " " + binPath;
  28. shortcut.Save();
  29. WScript.Echo("Shortcut '" + linkName + "' created on desktop.");