I am running an old application called ACSLX
. It is trying to call a DOS move command, but because sh.exe
is in my path, I am getting an error. sh.exe
is part of Git
and also RTools
, both of which I have installed. As you can see it is simply trying to move a file, but this is failing. How can I prevent this? This is the console output of ACSLX when I try to build the "Spring" example project.
##### Build starting...
C:\acslX\ShSysTime.exe
Current System Time 15:05:02
"C:\acslX\atrans.exe" -lic_path "C:\acslX\license.lic;C:\acslX\*.lic" -no_xsl -no_compile -no_link "C:\acslX\Examples\MODELD~1\SPRING~1\SPRING~2\spring.csl"
ACSL Translator
Copyright 2002-2015, AEgis Technologies Group, Inc.
All rights reserved.
--------------------------------------------------------
The license path is now: C:\acslX\license.lic;C:\acslX\*.lic
INFO: TRANSLATOR: Starting Translation...
INFO: ANALYZER: Sorting sections using DFS algorithm.
INFO: ANALYZER: Sorting performed in 0.001000 seconds.
INFO: Translator completed successfully
===================================
move "C:\acslX\Examples\MODELD~1\SPRING~1\SPRING~2\spring.xml" ".\spring.ail"
/Rtools/bin/sh: move: command not found
C:\acslX\mingw32\bin\make.exe: *** [spring.ail] Error 127
##### Build failed.
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.
来源:https://stackoverflow.com/questions/51941086/sh-exe-is-preventing-windows-cmd-move-command-from-working