AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

START - problem, any1 knows batch scripting?

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> General Chat
View previous topic :: View next topic  
Author Message
neXt



Joined: 19 Mar 2007
Posts: 463

PostPosted: Fri Mar 07, 2008 6:42 am    Post subject: START - problem, any1 knows batch scripting? Reply with quote

i ran into a weird problem with a "bat" file that i'm making.
Code:
START "C:\documents and settings\user\somefile.exe"
is not working and i'm soooooooo confused, 'cause
Code:
START C:\"documents and settings\user\somefile.exe"
works just fine. I'm guessing that "colon" is the one that messes stuff up, tried some character escaping with no positive results.
How can i fix this?
Back to top
View user's profile Send private message
aCkRiTe



Joined: 21 Jul 2006
Posts: 502

PostPosted: Fri Mar 07, 2008 6:50 am    Post subject: Reply with quote

This should work:

Code:

START "" "C:\documents and settings\user\somefile.exe"


the first set of colons is for the title name of the window.
_________________

HTH...

Back to top
View user's profile Send private message
ManaUser



Joined: 24 May 2007
Posts: 901

PostPosted: Fri Mar 07, 2008 7:02 am    Post subject: Reply with quote

I think the problem is that it expects the first thing in quotes to be the "title" parameter. I maybe thought that meant the command doesn't need quotes, but it does.

This seemed to work:
Code:
START "" "C:\documents and settings\user\somefile.exe"

But I'm not sure if specifying a blank title might do any harm, it didn't seem to have any effect when I started notepad with it.
Back to top
View user's profile Send private message
neXt



Joined: 19 Mar 2007
Posts: 463

PostPosted: Fri Mar 07, 2008 3:55 pm    Post subject: Reply with quote

Thanks guys Very Happy !
Back to top
View user's profile Send private message
neXt



Joined: 19 Mar 2007
Posts: 463

PostPosted: Fri Mar 07, 2008 4:22 pm    Post subject: Reply with quote

How do i loop through files and launch my app. only after it's been detected?

This language is so confusing, here's what i have so far:
Code:

If Exist "C:\Documents and Settings\me\Desktop\scripts\Alias\Alias.ahk"
   DEL "C:\Documents and Settings\me\Desktop\scripts\Alias\Alias.exe"

XCOPY "\\Cwidomain\Accounting\GENERAL\Scripts\Alias\Alias.exe" "C:\Documents and Settings\me\Desktop\scripts\Alias\"
FOR \R "C:\Documents and Settings\me\Desktop\scripts\Alias\" %%G IN (*.exe) DO
   If Exist "C:\Documents and Settings\me\Desktop\scripts\Alias\Alias.ahk" EXIT FOR
   
START "" "C:\Documents and Settings\me\Desktop\scripts\Alias\Alias.ahk"

Back to top
View user's profile Send private message
Fry



Joined: 01 Nov 2007
Posts: 610

PostPosted: Sat Mar 08, 2008 7:38 pm    Post subject: Reply with quote

i use Call instead of Start to run a program in batch

@neXt i dont think it is confusing.
_________________
check out my site
www.eliteknifesquad.com
Back to top
View user's profile Send private message
m^2



Joined: 28 Feb 2008
Posts: 56
Location: Krk, PL

PostPosted: Sat Mar 08, 2008 7:52 pm    Post subject: Reply with quote

Fry wrote:
i use Call instead of Start to run a program in batch

@neXt i dont think it is confusing.

Why? As far as I know "call myprog.exe" is not different from "myprog.exe".
Am I wrong?
Start is different because it doesn't wait for the program to exit.
_________________
Waiting for Windows 8...
Back to top
View user's profile Send private message
neXt



Joined: 19 Mar 2007
Posts: 463

PostPosted: Sat Mar 08, 2008 11:56 pm    Post subject: Reply with quote

Fry, so if you know it, can you help me? i want it to run my app only after copying is fully complete. For now i settled with making it sleep for 5 seconds, but this is a weak solution since if a PC will lag and take longer than 5 secs to copy then update will be unsuccessful.
P.S from online references i understood that call is used to call another bat from you script, kind of like in VBA when you call another module.
Back to top
View user's profile Send private message
aCkRiTe



Joined: 21 Jul 2006
Posts: 502

PostPosted: Sun Mar 09, 2008 12:50 am    Post subject: Reply with quote

Im not a 100% sure, but doesnt the copy command wait for the file to be copied before moving to the next line in the script. You can always check the errorlevel to ensure there were no problems. The errorlevel should return 0 if copied correctly.

Code:

:Copy
copy "\\Cwidomain\Accounting\GENERAL\Scripts\Alias\Alias.exe" "C:\Documents and Settings\me\Desktop\scripts\Alias\"
If %ErrorLevel% NEQ 0 Goto Copy


if the copy command doesnt wait for the file to be copied or you having issues with it, you can always create a second batch file with just the copy command in it and call it using the start /wait commad. This with wait for the second batch to finish before moving on in your main batch file.
_________________

HTH...

Back to top
View user's profile Send private message
neXt



Joined: 19 Mar 2007
Posts: 463

PostPosted: Sun Mar 09, 2008 1:27 am    Post subject: Reply with quote

So copy will wait until a file is fully copied before moving on? I'll test it out on Monday, i didn't know that.
I should be good now Very Happy , thanks for this tip.
Back to top
View user's profile Send private message
aCkRiTe



Joined: 21 Jul 2006
Posts: 502

PostPosted: Sun Mar 09, 2008 1:30 am    Post subject: Reply with quote

yes, I pretty sure both copy and xcopy wait for the file to be copied. I tested copying a large file with a pause in the next line of the batch file I had the destination folder open and it seemed to wait for the file to be there before I saw the pause command take effect. Anyways, hope this helps...
_________________

HTH...

Back to top
View user's profile Send private message
neXt



Joined: 19 Mar 2007
Posts: 463

PostPosted: Sun Mar 09, 2008 3:19 am    Post subject: Reply with quote

It does help Very Happy , thanks a lot!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> General Chat All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group