[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程批处理在线视频分享
返回列表 发帖

[系统相关] bat转换sh在linux中执行

请问.bat的批处理文件如何在linux下执行。具体如下:
  1. @echo off
  2. setlocal EnableDelayedExpansion
  3. echo VirtualBox Hider for SolidWorks
  4. echo by TeAM SolidSQUAD-SSQ
  5. if "%1"=="" goto usage
  6. set VMNAME=%1
  7. VBoxManage setextradata "%VMNAME%" "VBoxInternal/Devices/pcbios/0/Config/DmiBIOSVendor" "American Megatrends Inc"
  8. VBoxManage setextradata "%VMNAME%" "VBoxInternal/Devices/pcbios/0/Config/DmiBIOSVersion" "2.1.0"
  9. VBoxManage setextradata "%VMNAME%" "VBoxInternal/Devices/pcbios/0/Config/DmiSystemVendor" "ASUSTek Computer"
  10. call:gen_random_string 9
  11. VBoxManage setextradata "%VMNAME%" "VBoxInternal/Devices/pcbios/0/Config/DmiSystemSerial" "string:!rand!"
  12. call:gen_random_string 20
  13. VBoxManage setextradata "%VMNAME%" "VBoxInternal/Devices/pcbios/0/Config/Port0/SerialNumber" "string:!rand!"
  14. call:gen_random_string 8
  15. VBoxManage setextradata "%VMNAME%" "VBoxInternal/Devices/pcbios/0/Port0/FirmwareRevision" "string:!rand!"
  16. VBoxManage setextradata "%VMNAME%" "VBoxInternal/Devices/pcbios/0/Port0/ModelNumber" "SEAGATE ST3750525AS"
  17. echo.
  18. echo Success!
  19. echo.
  20. pause
  21. goto:eof
  22. :usage
  23. echo Usage: %0 VM-Name
  24. echo This script shold be started from HOST machine
  25. echo where VM-name is a name of STOPPED VirtualBox virtual machine
  26. echo Note: the PATH variable must contain path to VBoxManage.exe
  27. echo like set PATH=C:\Program Files\Oracle\VirtualBox;%%PATH%%
  28. echo.
  29. pause
  30. goto:eof
  31. :gen_random_string
  32. set lineup=0123456789ABCDEF
  33. set RandomLength=%1
  34. set count=0
  35. set rand=
  36. :loop
  37. set /a count+=1
  38. set /a_RND=%Random%*15/32768
  39. set rand=!rand!!lineup:~%_RND%,1!
  40. if !count! lss %RandomLength% goto loop
  41. :eof
复制代码

BAT是无法在Linux里面执行的,需要找个懂sh而且知道你想实现什么功能的人把代码重写一遍。
【扫描二维码捐助论坛的朋友请留言注明论坛账号】http://bbs.bathome.net/thread-10403-1-1.html
【批处理在线视频分享】http://bbs.bathome.net/thread-31727-1-1.html
【微信公众号、微信群、QQ群】http://bbs.bathome.net/thread-3473-1-1.html

TOP

我连现在的bat都没看太明白。。。:dizzy:

TOP

返回列表