Advertisement
marioq

notepad++ExecCMD.cmd

Jul 15th, 2022
994
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 3.19 KB | None | 0 0
  1. ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2. ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3. ::::
  4. ::::     https://npp-user-manual.org/docs/config-files/#editing-configuration-files
  5. ::::     https://npp-user-manual.org/docs/preferences/#shortcut-mapper
  6. ::::     https://npp-user-manual.org/docs/editing/#other-editing-commands-and-shortcuts
  7. ::::
  8. :::: Questo file "notepad++ExecCMD.cmd"
  9. :::: permette a Notepad++ di aprire una finestra cmd "(cmd /k Full_Path_To_FileFolder)"
  10. :::: nella directory del file aperto.
  11. ::::
  12. :::: Mettilo in una cartella inserita in %PATH%
  13. ::::
  14. :::: Nel file di configurazione di Notepad++
  15. :::: %appdata%\Notepad++\shortcuts.xml
  16. :::: per tutti gli utenti
  17. :::: %ProgramFiles%\Notepad++\shortcuts.xml
  18. :::: nella sezione <UserDefinedCommands>
  19. :::: aggiungere questa riga
  20. :::: <Command name="Apri terminale cmd nella dir del file.." Ctrl="no" Alt="yes" Shift="yes" Key="90">cmd /k "full_path_to_this_file\notepad++ExecCMD.cmd" &quot;$(FULL_CURRENT_PATH)&quot;</Command>
  21. ::::
  22. :::: il file notepad++OpenCmdHere.cmd
  23. :::: lo fà per te.
  24. ::::
  25. ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  26. ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  27. ::::    OLD-DOS stupid scripting language
  28. ::::    OLD-DOS stupido linuaggio di script
  29. ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  30.  
  31. @echo off
  32.  
  33. if .%1==. (
  34.     echo\
  35.     echo\##################################################
  36.     echo    Questo file:
  37.     echo  "%~f0"
  38.     echo    é usato da Notepad++ per aprire
  39.     echo    una finestra cmd "(cmd /k Full_Path_To_FileFolder)"
  40.     echo    nella directory del file aperto.
  41.     echo\
  42.     echo    Mettilo in una cartella inserita in %%PATH%%
  43.     echo\
  44.     echo    Nel file di configurazione di Notepad++
  45.     echo "%appdata%\Notepad++\shortcuts.xml"
  46.     echo    nella sezione
  47.     echo ^<UserDefinedCommands^>
  48.     echo .. .  .   .
  49.     echo ^</UserDefinedCommands^>
  50.     echo    aggiungi questa riga:
  51.     echo\"<Command name="Apri terminale cmd nella dir del file.." Ctrl="no" Alt="yes" Shift="yes" Key="90">cmd /k "%~f0" &quot;$(FULL_CURRENT_PATH)&quot;</Command>"
  52.     echo\
  53.     echo    lo script "notepad++OpenCmdHere.cmd"
  54.     echo    lo fà per te.
  55.     echo\##################################################
  56.     echo\
  57.     exit /b 1
  58. )
  59.  
  60. net session /list >nul 2>&1 && set "MY_USER_IS_ADMIN=%errorlevel%"
  61. if defined MY_USER_IS_ADMIN set "MY_USER_IS=[Administrator]"
  62. if not defined MY_USER_IS_ADMIN set "MY_USER_IS=[User]"
  63.  
  64. set "MY_FILE_PATH=X"
  65. if exist %1 (
  66.     set "MY_FILE_PATH=%~dp1"
  67.     set "MY_FILE_NAME=%~nx1"
  68.     set "MY_FILE_SIZE=%~z1"
  69.     set "MY_FILE_DATE=%~t1"
  70. ) else (
  71.     set MY_FILE_PATH=
  72. )
  73.  
  74. if not defined MY_FILE_PATH (
  75.     cd "%userprofile%"
  76.     title %MY_USER_IS% %username% notepad^+^+  %date% %time%
  77.     echo notepad^+^+
  78.     echo file non ancora salvato %1
  79. )
  80.  
  81. if defined MY_FILE_PATH (
  82.     cd "%MY_FILE_PATH%"
  83.     title %MY_USER_IS% %username% notepad^+^+  "%MY_FILE_PATH%"  %date% %time%
  84.     echo\notepad^+^+ Apre cmd nella cartella del file
  85.     echo "%MY_FILE_PATH%"
  86.     echo "%MY_FILE_NAME%" %MY_FILE_SIZE%^(byte^) modificato il %MY_FILE_DATE%
  87. )
  88.  
  89. for /f "delims=^=" %%A in ('@set MY_') do @set "%%A="
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement