sh.exe is preventing windows cmd move command from working

馋奶兔 提交于 2019-12-06 11:42:01

Another option is to have a little .bat ready to set your PATH whenever you need it:

Call it senv.bat, and put it in your current %PATH%

In it:

set PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\
set PATH=C:\acslX;%PATH%
... other PATHs you might need

Simply don't add GitHub path or R path in it to avoid any conflict.

In any CMD where you need to do an ACSLX session, type 'senv': that session will have a simplified PATH with only what you need.
No need to rename anything.

Outside of that session, your usual current PATH remains unchanged.


The OP adds:

, I am not working in the command line, I am working in the ACSLX GUI, I don't think I can modify the scripts it is running in the background.

To which I replied: the ACSLX GUI be launched with the proper PATH.
That is what the OP's answer implements.

The problem is that there is no external command "move" in Windows. If you look at your C:\Windows\system32 directory (or whatever it is called in your Windows version), you will find a lot of familiar Windows commands, such as XCOPY, HELP, SUBST and so on, but no MOVE. No wonder, that sh can't find it.

The reason that you can use MOVE from the DOS prompt is, that this is an internal command of CMD.EXE. Hence, you have to invoke CMD in order to use MOVE, something like this (untested!):

CMD /C MOVE "C:\acslX\Examples\MODELD~1\SPRING~1\SPRING~2\spring.xml" ".\spring.ail"

I solved this by creating a bat file ACSLXLauncher.bat which removed the sh.exe locations from the path prior to launching acslx.exe:

Can I set an environment variable for an application using a shortcut in Windows?

Remove unwanted path name from %path% variable via batch

rem this is necessary because sh.exe in the path prevents ACSLX from working
@echo off
set PATH=%PATH:C:\Program Files\Git\bin;=%
set PATH=%PATH:C:\RTools\3.4\bin;=%
start "" "C:\acslX\acslx.exe"

I also created a shortcut to run this bat file using cmd /c C:\..\ACSLXLauncher.bat so that I could pin it to the task bar.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!