Long PathClass (input line too large) - scala

I'm trying to execute a .bat file using CMD on windows. the command: D:\Candidate_Retrieval\target\universal\candidate-retrieval-1.0\bin> candidate-retrieval
The error was:
The input line is too long.
The syntax of the command is incorrect.
I opened the .bat file and I found the classpath as follows:
set "APP_CLASSPATH=%APP_LIB_DIR%\..\conf\;
%APP_LIB_DIR%\candidate-retrieval.candidate-retrieval-1.0-sans-externalized.jar;%APP_LIB_DIR%\org.scala-lang.scala-library-2.11.7.jar;%APP_LIB_DIR%\com.typesafe.play.twirl-api_2.11-1.1.1.jar;%APP_LIB_DIR%\org.apache.commons.commons-lang3-3.4.jar;%APP_LIB_DIR%\org.scala-lang.modules.scala-xml_2.11-1.0.1.jar;%APP_LIB_DIR%\com.typesafe.play.play-server_2.11-2.4.8.jar;%APP_LIB_DIR%\com.typesafe.play.play_2.11-2.4.8.jar;%APP_LIB_DIR%\com.typesafe.play.build-link-2.4.8.jar;%APP_LIB_DIR%\com.typesafe.play.play-exceptions-2.4.8.jar;%APP_LIB_DIR%\org.javassist.javassist-3.19.0-GA.jar;%APP_LIB_DIR%\com.typesafe.play.play-iteratees_2.11-2.4.8.jar;%APP_LIB_DIR%\org.scala-stm.scala-stm_2.11-0.7.jar;%APP_LIB_DIR%\com.typesafe.config-1.3.0.jar; ... .jars
I made some search, the solutions could be one of these: https://www.scala-sbt.org/sbt-native-packager/recipes/longclasspath.html.
but I don't know how to apply them. could someone elaborate more in simple steps?
Can longpathtool helps? how?

Related

'powershell.exeA' is not recognized as an internal or external command,

I am running into a bit of a problem when attempting to use Powershell with NRPE. Now I ran this command,
command[alias_check_commerce_log]=cmd /c echo C:\Program Files\nrpe\plugins\file_checker.ps1; exit($LastExitCode) | powershell.exe -command -
in cmd and it went through without a hitch. Just when I call it via Icinga, for some odd reason, it spits out 'powershell.exeA' is not recognized as an internal or external command. Now I know the A is not supposed to be sitting with powershell.exe, so how would I keep this from happening? Keep in mind that the command is the same in the config as posted here. Checked all text in hopes of it just being a simple Typo. I just can't seem to wrap my head around this one and figure out how to keep this from happening. Any and all help is appreciated, thank you.
Probably file encoding. You likely copy/pasted the command line from a web site or something, and there is a special character after .exe.
Open the file where that command is defined in an editor that supports different encodings and hopefully one that can show whitespace and "special" characters, and inspect the file.
Or Start over and manually type the commands.

Bat script cuts off random characters of next line

I've got a bat script that does a few cmds and also runs a stack of powershell scripts. Sometimes it errors out on the second or third command because it's cutting off a few characters. It's also done this on xcopy commands following a powershell script and vice versa. So here is an example:
Bat file:
xcopy "\\server\####\####\######" "C:\######" /S/I/E/Y
powershell "C:\SetupVM.ps1"
output:
\\server\Hard Disks\******.vhdx
\\server\Virtual Machines\*******.XML
2 File(s) copied
C:\Users\*****>rshell "C:\SetupVM.ps1"
'rshell' is not recognized as an internal or external command,
operable program or batch file.
Has anyone seen this before? Any ideas on how to avoid it?
Try opening your batch file in Notepad, and then 'Save As...' and be sure to select the ANSI encoding. Then don't touch it in your other editor :D.
It seems related to this issue.
I ran into this trying to write a batch file in Atom, and I think it was automatically encoding it to UTF-8. Opening in Notepad and re-saving it using ANSI encoding solved it for me.
A complicating issue for me was that my script was switching back and forth between git branches during my batch file, and if the batch file was different between the branches it would start to execute only partial lines as the computer would try to pick up the next piece of the batch, and it was causing the same issue.
From what I can see, the command line does not recognize the 'rshell' command.
Check your enviroment variables or start the command from where 'rshell'.com/.exe is located.
Other than this there is not much to say without seeing the content of the powershell script...

how to run a cmd file from matlab

I am trying to run a cmd file from MATLAB but unable to execute it. Can anybody see nay problem in the below code?
this is what I have inside my cmd file:
echo on
>test.log 2>&1 (
C:/testProj/Make/makeit.cmd param1
)
And this is the MATLAB code:
Out = 'C:/testProj/test.cmd';
system(Out);
But this actually does not run the cmd file.
Well for somereason it would not run if i would give the complete path of the cmd in bat file. so I had a cd command to change the directory and then run. now it runs fine, Thanks all appreciate your help!
What about using eval, like this:
eval(['!test.cmd']);
I have succesfully used this to run .bat files (and this output of the .bat script showed in my matlab command line). I also found this dos command, but I am not sure if it works allright:
You can just type the following strings to get things down:
!(c:/testProj/test.cmd)
This is actually no different from
system('c:/testProj/test.cmd')
I think you should check if the path is wrong. As to your code in the cmd file, that's beyond my ability to help.

copy command syntax error in Windows XP

Basically I am just trying to create a batch file to copy one file from one location to another location in Windows XP like the code below but failed. May I know why?
copy C:/Directory_A/the_file D:/Directory_B
When I execute the batch file I see this in the output:
The syntax of the command is incorrect.
Try using backslashes
copy C:\Directory_A\the_file D:\Directory_B

Calling a command line program

I have a executable that when double clicked opens in a command line window.
Now there is a input file (i.e named "sphere_15000.inp") in the same directory where the executable apame_win64.exe is located. So we can inter the file name in the command line.
The question is how this can be done from mathematica front end? With the RunThrough command I tried to do it with no avail.
RunThrough["Executable Location", "sphere_15000"]
Do I need to put this file location in my Windows 7 environment path variable? Hope for some suggestion in this regard.
UPDATE
Found a solution to my problem.
First set the Mathematica directory to the folder where the executable is located.
path="C:\Users\FlowCrusher\Desktop\CUSP solver\Apame_build_2011_01_09\solver";
SetDirectory[path];
Then use the following style of input.
Run["\"\"apame_win64.exe\" \"input\"\""]
Here "apame_win64.exe" is the executable one want to run and "input" is the input file for the executable. This solves the problem. But a new item in the wishlist.
Is there a way to hide the console window in the background?
Here is how it looks on my screen.
As Chris suggested if we use minimized console in the Run command we get a minimized window but the program does not execute.
I hope that a solution exists.
BR
Yes, you might put the folder of you executable into the Path variable, or provide the full path name.
However, RunThrough seems to have been superseeded (on Windows) by
Import["!command ","Text"], which will execute command and read the comaand line output into Matheamtica as a string.
E.g.:
Export["testit.txt", "bla", "Text"];
Import["!dir" <> " testit* > dir.log", "Text"];
FilePrint["dir.log"]
--
Otherwise, I also had good results in the past using NETLink (not sure if WScript.shell
still works on Windows7/8 or if one should use something else).
Emulating Run (RunThrough is not really needed I think):
Run2[cmd_String] := Module[{shell},
Switch[$OperatingSystem,
"Windows",
Needs["NETLink`"];
shell = NETLink`CreateCOMObject["WScript.shell"];
shell # run[cmd,0,True],
"Unix",
Run # cmd,
"MacOSX",
Run # cmd ] ];
Can you run your application with input from a basic command window instead of the application console? This might be the form of command you would need:
apame_win64 -input sphere_15000.inp
or simply
apame_win64 sphere_15000.inp
You can probably check the available switches by running apame_win64 -help
A multi-part command can be run from Mathematica, e.g.
Run["type c:\\temp\\test.txt"]
Alternatively, also returning output to the Mathematica session:
ReadList["!type c:\\temp\\test.txt", String]
I landed here wanting to run abaqus command line on windows.
The solutions provided here worked out for me (Windows 7, Mathematica 9):
SetDirectory#path;
Run["start /min abaqus job=" <> fileName <> " interactive ask_delete=OFF >> log.txt"]
(Here the abaqus option ask_delete=OFF overwrites an existing simulation results and the >> redirects all the output to a file)
I think, minimizing the window did not run in your case since the executable throws open that window. In that case, this might be of some help