NotePad中的NPPExec控制台

时间:2013-01-10 18:41:27

标签: unix notepad++

提前致谢:

我正在尝试使用Notepad ++登录UNIX系统。我正在使用NPPExec控制台来执行此操作,并且登录过程有效...有点儿。我使用NPPExec来执行这个名为“sasunix.sh”的脚本:

“C:\ userblah \ username \ Desktop \ plink.exe”-load“SUN4”-l myloginname -pw mypassword

正如你所看到我使用Putty的命令行程序“plink.exe”发送命令; “SUN4”是我正在使用的会话配置文件。问题是,下一个屏幕登录(成功),但继续向我询问我的密码额外的时间(这是登录程序的一部分),然后请求我的终端仿真设置(对我来说,这个是'xterm')。

问题:我会在UNIX系统上添加哪些额外的行来执行这一系列的输入(即每次单独输入并按“ENTER”):

1。)密码2.)xterm 3.)sas -nodms -nonews

我认为这归结为对NotePad ++和NPPExec控制台窗口之间如何传递命令的误解。在任何时候,如果我按“F6”,会弹出一个提示,说“警告:控制台进程仍在运行......”。这个消息框提示允许我输入一行然后发送到控制台...但是如何将一系列这些输入放入脚本?

1 个答案:

答案 0 :(得分:0)

你现在已经解决了这个问题, 但我做了以下

  1. 一个Windows批处理脚本,它根据目录路径

    创建一个带有unix命令的文件
    @ECHO OFF
    
    :: store input variable
    
    set str=%1
    
    :: remove C:\ or Z:\ etc
    
    set str=%str:~3%
    
    :: replace \ with /
    
    set str=%str:\=/%
    
    :: append cd command
    
    set str1=cd
    
    set str=%str1% %str%
    
    echo.%str%
    
    :: make
    
    echo make clean
    
    echo make all
    
  2. 将NppExec插件安装到Notepad ++

  3. 将* .bat脚本和plink.exe放在Notepad ++程序目录中

  4. 创建NppExec命令

    // This line calls the bat file and creates a file tempcmd.sh with unix commands in it
    "$(NPP_DIRECTORY)\unix_make_all.bat" $(CURRENT_DIRECTORY) >tempcmd.sh`
    
    
     // This line connects to a remote machine and runs all the commands stored in tempcmd.sh
     "$(NPP_DIRECTORY)\plink.exe" -ssh -2 -l username -pw password 192.168.000.000 -m "$(NPP_DIRECTORY)\tempcmd.sh"
    
  5. 使用NppExec选项我保存上述命令并在宏菜单中放置一个快捷方式