Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.help > #2646

Re: from cmd to Java

Newsgroups comp.lang.java.help
Date 2013-04-04 18:13 -0700
References <73c0a1b4-b8b2-4e10-9cfa-bc6118f5c633@googlegroups.com>
Message-ID <e705ac9f-75c0-4300-916b-b98d417b0598@googlegroups.com> (permalink)
Subject Re: from cmd to Java
From Lew <lewbloch@gmail.com>

Show all headers | View raw


J Lee Hughes wrote:
> how to code this in java [sic] not script but compiling
> this is in cmd
> 
> set home=%~dp0

This would likely be a variable assignment in Java.

> set file_to_find=A_job-2-do_

You would use a 'String' to hold the filename, then build probably a 'java.io.File' 
over that.

> set when_done=B_Job-done

Looks like a boolean condition in a 'while' or 'for' type of construct in Java.

> for /f "delims=" %%A in ('dir /s/b/o:n/d:-a ^"%home%%file_to_find%^"') do (

Java 'for' loop.

>  for /f "delims=" %%z in ('call rename.cmd ^"%%~A^" ^"\%file_to_find%^" "\%when_done%"') do (

You would have to code up the rename. There's a method in 'java.io.File' that could help.

>      for /f "tokon=1,2 delims=" %%B in (%%~A) do (

Whatever this is supposed to do, you can do with a 'for' loop and parsing or splitting out 
stuff from a 'String'.

>         "7za.exe" a -t7z -m0=LZMA -mmt=on -mx9 -md=128m -mfb=273 -ms=e -sccUTF-8 -w"%%~dpA" "%%~B" "%%~A" 

If you already have an executable, would you recode it in Java or use it directly?

>      )
>  rename "%%~A" "%%~nx.z"
> )
> echo done

'System.out.println("done");'

> pause

Various 'sleep()' methods.

-- 
Lew

Back to comp.lang.java.help | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

from cmd to Java kc0hwa@gmail.com - 2013-04-04 17:42 -0700
  Re: from cmd to Java Joerg Meier <joergmmeier@arcor.de> - 2013-04-05 02:47 +0200
    Re: from cmd to Java J Lee Hughes <kc0hwa@gmail.com> - 2013-04-04 19:47 -0700
  Re: from cmd to Java Lew <lewbloch@gmail.com> - 2013-04-04 18:13 -0700
  Re: from cmd to Java J Lee Hughes <kc0hwa@gmail.com> - 2013-04-04 19:31 -0700
  Re: from cmd to Java J Lee Hughes <kc0hwa@gmail.com> - 2013-04-04 19:42 -0700
    Re: from cmd to Java Lew <lewbloch@gmail.com> - 2013-04-04 22:30 -0700
      Re: from cmd to Java J Lee Hughes <kc0hwa@gmail.com> - 2013-04-05 03:39 -0700
        Re: from cmd to Java 1connu <1connu999@gmail.com> - 2013-04-05 13:16 +0200
          Re: from cmd to Java J Lee Hughes <kc0hwa@gmail.com> - 2013-04-05 04:27 -0700
        Re: from cmd to Java paul.cager@gmail.com - 2013-04-05 04:27 -0700
          Re: from cmd to Java J Lee Hughes <kc0hwa@gmail.com> - 2013-04-05 06:55 -0700
            Re: from cmd to Java Lew <lewbloch@gmail.com> - 2013-04-05 13:35 -0700
  Re: from cmd to Java Roedy Green <see_website@mindprod.com.invalid> - 2013-04-04 22:44 -0700

csiph-web