Mate de Vita

Mate de Vita

User name
Mate de Vita
Assigned title
Kelli
Assigned post color
#2288ff
Avatar
Medals
 
Registration date
2008 October 4
Post count
2452
Score
159 ₧
Location
Planting at B
Signature
...and that's the bottom line because Mate de Vita said so.
Timezone
Europe/Ljubljana
Groups
 

Recent posts by Mate de Vita

Recent posts by Mate de Vita

2015 Aug 13 at 13:49 PDT
The Quiet Truck in General
2015 Aug 3 at 11:45 PDT
Help. in General
BloodFarts said:
I assaulted a spider with a cactus. I think it has rights to an attorney but I'm not sure. Help plz.

Your question is somewhat ambiguous, are we talking about the spider's rights or the cactus'?
2015 Apr 8 at 13:50 PDT
I'd say the older games tend to be longer actually.
2015 Mar 19 at 13:59 PDT
I have no strong feelings one way or the other.
2015 Mar 9 at 15:10 PDT
Batch in if( while ) switch{ coding } ++
To be fair, Windows does have Powershell, which is slightly better than the standard command prompt.
2015 Mar 7 at 10:51 PST
Batch in if( while ) switch{ coding } ++
I've done a bit of scripting in Bash in one of my classes but I'm pretty much completely new to batch scripts. I would like to run the following command from a batch script:
code
java -cp "C:\path to external jar;C:\Path to Java project bin" main.MP3Edit [-p path_to_target_dir] [File1 ...]

by allowing the user (me) to input the path to target directory and the file names into the command prompt terminal (yes, I could read the input in the Java program itself but let's say I'm running someone else's program and can't change it).

I've written the following batch script using a few things I found on Google:
code
@echo off
set /p "arg=Input the path to target directory (defaults to current directory if left empty): "
if not [%arg%]==[] set "arg=-p %arg%"

echo Input file names one per line. If no file names are input, all files in the target directory will be used.
:loop
set /p "line=Input next file name (leave empty to end list of files): "
if [%line%]==[] goto run
set "arg=%arg% %line%"
set line=
goto loop

:run
REM java -cp "C:\path to external jar;C:\Path to Java project bin" main.MP3Edit %arg%
echo %arg%
pause


Now the problem with this is that the path and the file names can have spaces in them, which means each of them should in the command be surrounded by quotation marks. In bash iirc you can achieve that by using a combination of single quotes and double quotes in the script, but single quotes don't seem to do anything in batch. How do I get each argument separately properly surrounded by quotation marks?

Also incidentally, is there a way to make set /p recognize an empty string as an input? Because in the above example, if I remove the "set line=" command, the loop doesn't exit even on empty input because the set /p (first line of the loop) doesn't seem to do anything if it receives empty input.
2015 Feb 12 at 09:02 PST
The best cure for ___ is a large ___.

Am I doing it right?
2014 Nov 2 at 12:38 PST
I'm guessing you two pulled one of these.
2014 Nov 2 at 06:04 PST
If those were potatoes, we have some weirdly shaped and coloured potatoes here.
2014 Nov 1 at 13:52 PDT
Kids don't really do anything on haloween over here tbh, other than maybe put a candle in the pumpkin their parents carved out. Over here candy is distributed in February/March, on a different holiday.