Skip to content
  • Home
  • Aktuell
  • Tags
  • 0 Ungelesen 0
  • Kategorien
  • Unreplied
  • Beliebt
  • GitHub
  • Docu
  • Hilfe
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Standard: (Kein Skin)
  • Kein Skin
Einklappen
ioBroker Logo

Community Forum

donate donate
  1. ioBroker Community Home
  2. Русский
  3. ioBroker
  4. Скрипты
  5. ioBroker скрипты
  6. Как организовать управление компьютером

NEWS

  • Neuer Blogbeitrag: Monatsrückblick - Dezember 2025 🎄
    BluefoxB
    Bluefox
    11
    1
    324

  • Weihnachtsangebot 2025! 🎄
    BluefoxB
    Bluefox
    24
    1
    1.5k

  • UPDATE 31.10.: Amazon Alexa - ioBroker Skill läuft aus ?
    apollon77A
    apollon77
    48
    3
    9.5k

Как организовать управление компьютером

Geplant Angeheftet Gesperrt Verschoben ioBroker скрипты
15 Beiträge 3 Kommentatoren 3.4k Aufrufe
  • Älteste zuerst
  • Neuste zuerst
  • Meiste Stimmen
Antworten
  • In einem neuen Thema antworten
Anmelden zum Antworten
Dieses Thema wurde gelöscht. Nur Nutzer mit entsprechenden Rechten können es sehen.
  • BluefoxB Offline
    BluefoxB Offline
    Bluefox
    schrieb am zuletzt editiert von
    #4

    > а как например батник запустить из под iobroker?

    var spawn = require('child_process').spawn;
    function startBat(filename) {
    	var ls    = spawn('cmd.exe', ['/c', filename]);
    	ls.stdout.on('data', function (data) {
    		log('stdout: ' + data);
    	});
    
    	ls.stderr.on('data', function (data) {
    		log('stderr: ' + data);
    	});
    
    	ls.on('exit', function (code) {
    		log('child process exited with code ' + code);
    	});
    }
    
    startBat('c:/myBatchFile.bat');
    
    

    или просто так, если не нужно знать, что там батник говорит:

    require('child_process').spawn('cmd.exe', ['/c', 'c:/myBatchFile.bat']);
    
    1 Antwort Letzte Antwort
    0
    • I Offline
      I Offline
      instalator
      schrieb am zuletzt editiert von
      #5

      @Bluefox:

      Многообещающий пакет https://github.com/octalmage/robotjs `
      Не могу установить, выдает ошибку

      c:\iobroker\node_modules\robotjs>node "C:\Program Files\nodejs\node_modules\npm\
      bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
      gyp ERR! configure error
      gyp ERR! stack Error: Can't find Python executable "python", you can set the PYT
      HON env variable.
      gyp ERR! stack     at failNoPython (C:\Program Files\nodejs\node_modules\npm\nod
      e_modules\node-gyp\lib\configure.js:103:14)
      gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node
      -gyp\lib\configure.js:64:11
      gyp ERR! stack     at Object.oncomplete (evalmachine.<anonymous>:108:15)
      gyp ERR! System Windows_NT 6.1.7601
      gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modu
      les\\node-gyp\\bin\\node-gyp.js" "rebuild"
      gyp ERR! cwd c:\iobroker\node_modules\robotjs
      gyp ERR! node -v v0.10.35
      gyp ERR! node-gyp -v v1.0.1
      gyp ERR! not ok
      
      npm ERR! robotjs@0.2.1 install: `node-gyp rebuild`
      npm ERR! Exit status 1
      npm ERR!
      npm ERR! Failed at the robotjs@0.2.1 install script.
      npm ERR! This is most likely a problem with the robotjs package,
      npm ERR! not with npm itself.
      npm ERR! Tell the author that this fails on your system:
      npm ERR!     node-gyp rebuild
      npm ERR! You can get their info via:
      npm ERR!     npm owner ls robotjs
      npm ERR! There is likely additional logging output above.
      npm ERR! System Windows_NT 6.1.7601
      npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nod
      ejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "robotjs"
      npm ERR! cwd c:\iobroker
      npm ERR! node -v v0.10.35
      npm ERR! npm -v 1.4.28
      npm ERR! code ELIFECYCLE
      npm ERR! not ok code 0</anonymous>
      

      Высокий уровень Децибел вреден для здоровья!

      http://blog.instalator.ru/

      1 Antwort Letzte Antwort
      0
      • BluefoxB Offline
        BluefoxB Offline
        Bluefox
        schrieb am zuletzt editiert von
        #6

        Ну тут немного сложнее, чем с другими пакетами:

        Нужно установить Python (2.7), VS 2013 express.

        тогда должно заработать.

        Здесь написано, что надо сделать:

        https://github.com/TooTallNate/node-gyp/#installation

        1 Antwort Letzte Antwort
        0
        • aurodionovA Offline
          aurodionovA Offline
          aurodionov
          schrieb am zuletzt editiert von
          #7

          @Bluefox:

          Нужно установить Python (2.7), VS 2013 express. `
          То есть он только под окна получается :o :(

          Пишу с пульта….

          1 Antwort Letzte Antwort
          0
          • BluefoxB Offline
            BluefoxB Offline
            Bluefox
            schrieb am zuletzt editiert von
            #8

            Нет. На линксе (debian) он сам собирается. нужно только до этого вызвать:

            sudo apt-get update
            sudo apt-get install build-essential
            
            
            1 Antwort Letzte Antwort
            0
            • I Offline
              I Offline
              instalator
              schrieb am zuletzt editiert von
              #9

              @Bluefox:

              или просто так, если не нужно знать, что там батник говорит:

              require('child_process').spawn('cmd.exe', ['/c', 'c:/myBatchFile.bat']);
              ```` `  
              

              Не получается запустить файлик таким способом. Какие еще варианты есть?

              По первому варианту получилось. Единственный момент от какого имени запускается cmd?

              Высокий уровень Децибел вреден для здоровья!

              http://blog.instalator.ru/

              1 Antwort Letzte Antwort
              0
              • I Offline
                I Offline
                instalator
                schrieb am zuletzt editiert von
                #10

                Если запускаю через radmin батник то удаленный комп отключается, если через iobroker то пишет что отказано в доступе.

                ! javascript-0 2015-08-22 19:29:10 info script.js.Scenes: child process exited with code 5
                ! javascript-0 2015-08-22 19:29:10 info
                ! javascript-0 2015-08-22 19:29:10 info script.js.Scenes: stderr: 192.168.1.10: �⪠���� � ����㯥.(5)
                ! javascript-0 2015-08-22 19:29:10 info
                ! javascript-0 2015-08-22 19:29:10 info script.js.Scenes: stdout: shutdown /s /t 00 /m \192.168.1.10
                ! javascript-0 2015-08-22 19:29:10 info C:\Windows\system32>
                ! javascript-0 2015-08-22 19:29:10 info script.js.Scenes: stdout:

                Высокий уровень Децибел вреден для здоровья!

                http://blog.instalator.ru/

                1 Antwort Letzte Antwort
                0
                • I Offline
                  I Offline
                  instalator
                  schrieb am zuletzt editiert von
                  #11

                  Запускаю батник скриптом:

                  require('child_process').spawn('cmd.exe', ['', 'c:/compoff.bat']);
                              var spawn = require('child_process').spawn;
                                      function startBat(filename) {
                                         var ls = spawn('cmd.exe', ['/c', filename]);
                                         ls.stdout.on('data', function (data) {
                                            log('stdout: ' + data);
                                         });
                                         ls.stderr.on('data', function (data) {
                                            log('stderr: ' + data);
                                         });
                                         ls.on('exit', function (code) {
                                            log('child process exited with code ' + code);
                                         });
                                      }  
                              startBat('c:/compoff.bat');
                  

                  Содержимое батника:

                  net use \\192.168.1.10 /user:instalator 
                  shutdown /s /t 3600 /f /m \\192.168.1.10
                  net use /delete \\192.168.1.10
                  

                  Вот что выдает в лог:

                  ! javascript.0 2015-11-05 21:39:54 info javascript.0 script.js.Scenes: child process exited with code 0
                  ! javascript.0 2015-11-05 21:39:53 info javascript.0 script.js.Scenes: stdout:
                  ! javascript.0 2015-11-05 21:39:53 info javascript.0 script.js.Scenes: stdout: \192.168.1.10 �ᯥ譮 㤠���.
                  ! javascript.0 2015-11-05 21:39:53 info javascript.0 script.js.Scenes: stdout: use /delete \192.168.1.10
                  ! javascript.0 2015-11-05 21:39:53 info javascript.0 script.js.Scenes: stdout: net
                  ! javascript.0 2015-11-05 21:39:53 info javascript.0 script.js.Scenes: stdout: C:\Windows\system32>
                  ! javascript.0 2015-11-05 21:39:53 info javascript.0 script.js.Scenes: stdout:
                  ! javascript.0 2015-11-05 21:39:53 info javascript.0 script.js.Scenes: stderr: 192.168.1.10: �⪠���� � ����㯥.(5)
                  ! javascript.0 2015-11-05 21:39:53 info javascript.0 script.js.Scenes: stdout:
                  ! javascript.0 2015-11-05 21:39:53 info javascript.0 script.js.Scenes: stdout: /s /t 3600 /f /m \192.168.1.10
                  ! javascript.0 2015-11-05 21:39:53 info javascript.0 script.js.Scenes: stdout: shutdown
                  ! javascript.0 2015-11-05 21:39:53 info javascript.0 script.js.Scenes: stdout: C:\Windows\system32>
                  ! javascript.0 2015-11-05 21:39:53 info javascript.0 script.js.Scenes: stdout:
                  ! javascript.0 2015-11-05 21:39:53 info javascript.0 script.js.Scenes: stdout: ������� �믮����� �ᯥ譮.
                  ! javascript.0 2015-11-05 21:39:53 info javascript.0 script.js.Scenes: stdout:
                  ! javascript.0 2015-11-05 21:39:53 info javascript.0 script.js.Scenes: stdout: use \192.168.1.10 /user:instalator
                  ! javascript.0 2015-11-05 21:39:53 info javascript.0 script.js.Scenes: stdout: net
                  ! javascript.0 2015-11-05 21:39:53 info javascript.0 script.js.Scenes: stdout: C:\Windows\system32>
                  ! javascript.0 2015-11-05 21:39:53 info javascript.0 script.js.Scenes: stdout:
                  Я так понимаю он рвет команды?

                  Высокий уровень Децибел вреден для здоровья!

                  http://blog.instalator.ru/

                  1 Antwort Letzte Antwort
                  0
                  • BluefoxB Offline
                    BluefoxB Offline
                    Bluefox
                    schrieb am zuletzt editiert von
                    #12

                    Он рвёт вывод. А команды нормальные

                    Тебе отказано в доступе

                    shutdown (5) access is denied
                    
                    1 Antwort Letzte Antwort
                    0
                    • I Offline
                      I Offline
                      instalator
                      schrieb am zuletzt editiert von
                      #13

                      @Bluefox:

                      Он рвёт вывод. А команды нормальные

                      Тебе отказано в доступе

                      shutdown (5) access is denied
                      ```` `  
                      

                      Как то читал эту кодировку не помню как), в какой он отдает?

                      Вот не пойму почему отказано, в безопасности добавил группу Все, если руками запускаю батник то все отрабатывает, а чз брокера нехотит.

                      Высокий уровень Децибел вреден для здоровья!

                      http://blog.instalator.ru/

                      1 Antwort Letzte Antwort
                      0
                      • BluefoxB Offline
                        BluefoxB Offline
                        Bluefox
                        schrieb am zuletzt editiert von
                        #14

                        Эту проблему можно решить так:

                        require('child_process').spawn('chcp 866 | cmd.exe', ['', 'c:/compoff.bat']);
                                    var spawn = require('child_process').spawn;
                                            function startBat(filename) {
                                               var ls = spawn('cmd.exe', ['/c', filename]);
                                               ls.stdout.on('data', function (data) {
                                                  log('stdout: ' + data);
                                               });
                                               ls.stderr.on('data', function (data) {
                                                  log('stderr: ' + data);
                                               });
                                               ls.on('exit', function (code) {
                                                  log('child process exited with code ' + code);
                                               });
                                            }  
                                    startBat('c:/compoff.bat');
                        
                        

                        Кодировка либо 866 либо 65001. Надо просто попробовать

                        1 Antwort Letzte Antwort
                        0
                        • I Offline
                          I Offline
                          instalator
                          schrieb am zuletzt editiert von
                          #15

                          http://forum.iobroker.net/viewtopic.php?f=29&t=1783

                          Высокий уровень Децибел вреден для здоровья!

                          http://blog.instalator.ru/

                          1 Antwort Letzte Antwort
                          0
                          Antworten
                          • In einem neuen Thema antworten
                          Anmelden zum Antworten
                          • Älteste zuerst
                          • Neuste zuerst
                          • Meiste Stimmen


                          Support us

                          ioBroker
                          Community Adapters
                          Donate

                          557

                          Online

                          32.5k

                          Benutzer

                          81.7k

                          Themen

                          1.3m

                          Beiträge
                          Community
                          Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen | Einwilligungseinstellungen
                          ioBroker Community 2014-2025
                          logo
                          • Anmelden

                          • Du hast noch kein Konto? Registrieren

                          • Anmelden oder registrieren, um zu suchen
                          • Erster Beitrag
                            Letzter Beitrag
                          0
                          • Home
                          • Aktuell
                          • Tags
                          • Ungelesen 0
                          • Kategorien
                          • Unreplied
                          • Beliebt
                          • GitHub
                          • Docu
                          • Hilfe