Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Need help with batch commands!

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Discussions
View previous topic :: View next topic  
Author Message
asianking
Expert Cheater
Reputation: 0

Joined: 25 Jun 2008
Posts: 107

PostPosted: Wed Feb 16, 2011 4:05 pm    Post subject: Need help with batch commands! Reply with quote

Is there a simpler way to knock down these codes into one line only?

Code:

IF %M%==5 xcopy /y "C:\project\*.accdb" "E:\Projects"
IF %M%==5 xcopy /y "C:\project\*.doc" "E:\Projects"
IF %M%==5 xcopy /y "C:\project\*.xlsx" "E:\Projects"


I tried using the & character, but still not working. What this batch code does is if I press 5, it will copy overwrite or just copy those extension type of files into my projects folder E drive. Isn't there a way I can just for example type:

Code:

IF %M%==5 xcopy /y "C:\Project\*.accdb&*.doc&*.slsx" "E:\Projects"


----------

If you ask why I didn't do the full folder copy to the E drive; It's because I have lots of other different files format types in there that I don't want it copy. Those are the main ones that I only need.

_________________
Back to top
View user's profile Send private message MSN Messenger
Jorg hi
I post too much
Reputation: 7

Joined: 24 Dec 2007
Posts: 2276
Location: Minnesota

PostPosted: Wed Feb 16, 2011 4:34 pm    Post subject: Reply with quote

Bruteforce the file types.
Back to top
View user's profile Send private message
asianking
Expert Cheater
Reputation: 0

Joined: 25 Jun 2008
Posts: 107

PostPosted: Wed Feb 16, 2011 5:34 pm    Post subject: Reply with quote

example pls...
_________________
Back to top
View user's profile Send private message MSN Messenger
AhMunRa
Grandmaster Cheater Supreme
Reputation: 27

Joined: 06 Aug 2010
Posts: 1117

PostPosted: Wed Feb 16, 2011 7:00 pm    Post subject: Reply with quote

Code:

set FILE_doc=* .doc
set FILE_accdb=* .accdb
set FILE_xlsx=* .xlsx

FOR /F "tokens=2* delims=_=" %A IN ('SET FILE_') DO xcopy c:\projects\%B e:\projects\


Try that.


http://www.robvanderwoude.com/battech_array.php

_________________
<Wiccaan> Bah that was supposed to say 'not saying its dead' lol. Fixing >.>
Back to top
View user's profile Send private message
asianking
Expert Cheater
Reputation: 0

Joined: 25 Jun 2008
Posts: 107

PostPosted: Thu Feb 17, 2011 9:24 am    Post subject: Reply with quote

works, but i'm not lookin for extra codes. I'm looking to short codes out to one line. I'm assuming there isn't a way then.

With that code, I could just go with my first code which is shorter. Thanks anyway, but is there another suggestion?

_________________
Back to top
View user's profile Send private message MSN Messenger
Fantasy
I post too much
Reputation: 13

Joined: 29 Jul 2007
Posts: 3113

PostPosted: Thu Feb 17, 2011 10:18 am    Post subject: Reply with quote

Jorg hi wrote:
Bruteforce the file types.

What? 0o

- Also, why is it needed to be a single line?
Back to top
View user's profile Send private message
AhMunRa
Grandmaster Cheater Supreme
Reputation: 27

Joined: 06 Aug 2010
Posts: 1117

PostPosted: Thu Feb 17, 2011 11:20 am    Post subject: Reply with quote

Why is it so important to have it all on one line?

Anyways, the code I gave needs slight modification.

Now for the ultra-mega-super-one liner
Code:

IF %M%==5 FOR /r C:\Project\ %%A IN ( *.accdb *.doc *.slsx ) DO xcopy "%%A" E:\Projects\ /y /s /e

_________________
<Wiccaan> Bah that was supposed to say 'not saying its dead' lol. Fixing >.>
Back to top
View user's profile Send private message
asianking
Expert Cheater
Reputation: 0

Joined: 25 Jun 2008
Posts: 107

PostPosted: Fri Feb 18, 2011 7:31 am    Post subject: Reply with quote

Will give it a try when I'm at work. Not important; just want it to shorten out most batch commands. Save disk space Razz
_________________
Back to top
View user's profile Send private message MSN Messenger
AhMunRa
Grandmaster Cheater Supreme
Reputation: 27

Joined: 06 Aug 2010
Posts: 1117

PostPosted: Fri Feb 18, 2011 9:22 am    Post subject: Reply with quote

OMG I hope you are joking about disk space. LMFAO

It will work as long as you run the batch from the same dir as your files, otherwise if you would like to run it from anywhere you need to change xcopy "%%A" to xcopy "C:\Projects\%%A"

_________________
<Wiccaan> Bah that was supposed to say 'not saying its dead' lol. Fixing >.>
Back to top
View user's profile Send private message
asianking
Expert Cheater
Reputation: 0

Joined: 25 Jun 2008
Posts: 107

PostPosted: Fri Feb 18, 2011 12:45 pm    Post subject: Reply with quote

for some reason it doesn't work. When I press 5, it automatic close the prompt right away. I check the folder and nothing was copy. Any idea why?

Here's the partial code I input and tell me what's wrong?

Code:

SET /P M=Type 1, 2, 3, 4, 5, or 6, then press ENTER:
IF %M%==1 xcopy /y /p "C:\project\Desk*" "E:\Projects"
IF %M%==2 xcopy /y /p "C:\project\Serv*" "E:\Projects"
IF %M%==3 xcopy /y /p "C:\project\Tuto*" "E:\Projects"
IF %M%==4 xcopy /y /p "C:\project\PCas*" "E:\Projects"
IF %M%==5 FOR /r C:\projects %%A IN (*.accdb *.doc *.slsx) DO xcopy "%%A" E:\projects /y /s /e
IF %M%==6 GOTO EOF

_________________
Back to top
View user's profile Send private message MSN Messenger
AhMunRa
Grandmaster Cheater Supreme
Reputation: 27

Joined: 06 Aug 2010
Posts: 1117

PostPosted: Fri Feb 18, 2011 2:23 pm    Post subject: Reply with quote

Just tested your code only changed the output dir to C:\test my E:\ is a cd burner, and added pause at the end to have it wait so I could see state, worked perfectly.

Code:


SET /P M=Type 1, 2, 3, 4, 5, or 6, then press ENTER:
IF %M%==1 xcopy /y /p "C:\project\Desk*" "E:\Projects"
IF %M%==2 xcopy /y /p "C:\project\Serv*" "E:\Projects"
IF %M%==3 xcopy /y /p "C:\project\Tuto*" "E:\Projects"
IF %M%==4 xcopy /y /p "C:\project\PCas*" "E:\Projects"
IF %M%==5 FOR /r C:\projects %%A IN (*.accdb *.doc *.slsx) DO xcopy "%%A" E:\projects /y /s /e
IF %M%==6 GOTO EOF

GOTO START

PAUSE



Add that pause there, take a look at the error. Also as I mentioned before as it is currently written it will only copy as long as it is run from the directory where the files are. You will need to specify the directory after the xcopy command.

xcopy "%%A" needs to be xcopy "c:\projects\%%A"

If you intend to run it from anywhere on your computer.


Also changed the code a bit to close when I wanted it to.

Code:

:START
SET /P M=Type 1, 2, 3, 4, 5, or 6, then press ENTER:
IF %M%==1 xcopy /y /p "C:\project\Desk*" "E:\Projects"
IF %M%==2 xcopy /y /p "C:\project\Serv*" "E:\Projects"
IF %M%==3 xcopy /y /p "C:\project\Tuto*" "E:\Projects"
IF %M%==4 xcopy /y /p "C:\project\PCas*" "E:\Projects"
IF %M%==5 FOR /r C:\projects %%A IN (*.accdb *.doc *.slsx) DO xcopy "%%A" E:\projects /y /s /e
IF %M%==6 GOTO EOF

:EOF

_________________
<Wiccaan> Bah that was supposed to say 'not saying its dead' lol. Fixing >.>
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Discussions All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites