Sign in to follow this  
Followers 0
jbennett

Open .lnk file in AutoIT

20 posts in this topic

#1 ·  Posted (edited)

Hi everyone,

I've got a problem with opening a .lnk file in AutoIT and can't seem to solve the problem :-(

I'm trying to open a .lnk file from a server location on the local machine.

e.g. server.something.local\c\work\backup\workbackup.lnk

This works fine until I put the AutoIT .exe file into a scheduled task created with the AT command and I have no idea why this occurs?

If I manually create the scheduled task with the local user then there is no problem

Does anyone know the correct code to open a .lnk file within a scheduled task?

Many thanks

Edited by jbennett

Share this post


Link to post
Share on other sites



Hi everyone,

I've got a problem with opening a .lnk file in AutoIT and can't seem to solve the problem :-(

I'm trying to open a .lnk file from a server location on the local machine.

e.g. server.something.local\c\work\backup\workbackup.lnk

This works fine until I put the AutoIT .exe file into a scheduled task created with the AT command and I have no idea why this occurs?

If I manually create the scheduled task with the local user then there is no problem

Does anyone know the correct code to open a .lnk file within a scheduled task?

Many thanks

Why not just start the exe then, if .lnk doesn't work?

I know I once had a similar problem with running a script in a scheduled task, but that had to do with Interactive or not.

If you need the "start minimized" or so, options, you could create a script that basically does what the .lnk does, compile it and add that compiled exe in a scheduled task.


You can fool some of the people all of the time, and all of the people some of the time, but you can not fool all of the people all of the time. Abraham Lincoln - http://www.ae911truth.org/ - http://www.freedocumentaries.org/

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

The only problem is that the .lnk file has some extra information within it, hence the reason for using the .lnk

In the target of the .lnk file there is additional information at the end.

"server1.system.local"

Edited by jbennett

Share this post


Link to post
Share on other sites

Doesn't really matter!

You can just select the exe (if you do it with "schedule a new task") and then add the parameters at the end of the line, like:

defrag.exe C:\ /f

Of course, if there are spaces in the path to the exe you need "..." :

"C:\some long path with spaces in it\defrag.exe" C:\ /f

You don't even need an autoit script for that. But you can if you like.


You can fool some of the people all of the time, and all of the people some of the time, but you can not fool all of the people all of the time. Abraham Lincoln - http://www.ae911truth.org/ - http://www.freedocumentaries.org/

Share this post


Link to post
Share on other sites

So I could create a scheduled task like the following:

server1.system.local\backup\network\backup.cmd "server1.system.local"

Does that sound correct?

thanks

Share this post


Link to post
Share on other sites

Yes, I would say so.

or...

server1.system.local\backup\network\backup.cmd server1.system.local -> that should work too, as long as there are no spaces in the parameters to pass.

you can just copy the entire "target" line from the shortcut and paste it in the scheduler.

Try it, it will work.


You can fool some of the people all of the time, and all of the people some of the time, but you can not fool all of the people all of the time. Abraham Lincoln - http://www.ae911truth.org/ - http://www.freedocumentaries.org/

Share this post


Link to post
Share on other sites

Cool that works.

The only problem is that when using the AT command to create the schedule it doesn't work.

I manually run the schedule created with the AT command and a cmd pops up for a split second and nothing happens.Hmm

Any ideaS?

Thanks

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

it may have to do with the "Interactive" feature. Don't know how you did the AT cmd and if it is Interactive per default or not, but that might be it.

Create the task with the wizard and check [EDIT: check, not in the sense of enabling all the options, but "view and remember" ! ] all the options once the task works as it should.

Then try to create an AT command so that those two tasks look exactly the same.

Good luck :P

Edited by Mojo

You can fool some of the people all of the time, and all of the people some of the time, but you can not fool all of the people all of the time. Abraham Lincoln - http://www.ae911truth.org/ - http://www.freedocumentaries.org/

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

This is my AT

del c:\windows\tasks\Scheduled_Backup.job

if not exist c:\windows\tasks\Scheduled_Backup.job at 00:00 /interactive /every:M,T,W,T,F,S,SU \\server.system.local\workBackup\Project2\Network\BakZIPs\userBackup.cmd "\\server.system.local"

rename C:\Windows\tasks\At1.job Scheduled_Backup.job

It seems like the PCs don't like the NT AUTHORITY/SYSTEM account that the AT command uses.

UPDATE

-------

Checked all the options and everything is the same apart from the RUN AS bit.

The manual scheduled task has the local user name, where as the AT has the NT AUTHORITY/SYSTEM account.

I need to use the NT AUTHORITY/SYSTEM account that as i'm rolling this out to lots of PCs

Edited by jbennett

Share this post


Link to post
Share on other sites

have you tried without "/Interactive" ?

Because I think the SYSTEM in most cases is never really logged on, but always in the background.


You can fool some of the people all of the time, and all of the people some of the time, but you can not fool all of the people all of the time. Abraham Lincoln - http://www.ae911truth.org/ - http://www.freedocumentaries.org/

Share this post


Link to post
Share on other sites

Yeah I tried without /interactive

You don't think this is a permission issue on the server?.

I logged in to the SYSTEM account and couldn't access any of the network shares. Hmm

Share this post


Link to post
Share on other sites

Yeah that makes sense.

Wouldn't be so funny if the local SYSTEM account could access every other machine as if it was that machine's SYSTEM account.

But if you add "Everyone" to the share(s) you need, it should work, I guess.


You can fool some of the people all of the time, and all of the people some of the time, but you can not fool all of the people all of the time. Abraham Lincoln - http://www.ae911truth.org/ - http://www.freedocumentaries.org/

Share this post


Link to post
Share on other sites

I will give it a try but I have a bad feeling about this.

Wish the AT command could specify another user other than the SYSTEM account.

I just need to ensure that it's locked down and the same on every PC

Share this post


Link to post
Share on other sites

You CAN specify another user. If not with AT then definitely with schtasks (which is the new AT).


You can fool some of the people all of the time, and all of the people some of the time, but you can not fool all of the people all of the time. Abraham Lincoln - http://www.ae911truth.org/ - http://www.freedocumentaries.org/

Share this post


Link to post
Share on other sites

Do you know how to use schtask?

I've had a look but it really confuses me.

You CAN specify another user. If not with AT then definitely with schtasks (which is the new AT).

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

SCHTASKS /Create /SC weekly /D MON,TUE,WED,THU,FRI /TN MyDailyBackup /ST 23:00:00 /TR \\server.system.local\workBackup\Project2\Network\BakZIPs\userBackup.cmd "\\server.system.local" /RU MyDomain\MyLogin /RP MyPassword

SCHTASKS /Delete /TN "MyDailyBackup" /f

I presume this is the type of code to use.

The problem is now with the "\\server.system.local" piece of code

Plus the scheduled task "run as" just defaults to the current logged in user :-(

Edited by jbennett

Share this post


Link to post
Share on other sites

solved that problem with the user account

The only problem I now have is the additional info bit "server.system.local"

Do you know where I would paste this?

thanks

Share this post


Link to post
Share on other sites

perhaps /U and /P instead of /RU and /RP -> the ones with /Rx seem to be for "remote"

but I don't know for sure. I barely ever used it before.

You'll just have to try different things and perhaps search the internet. Definitely not an AutoIt related problem anymore :P

The "\\server.system.local" thingy might work if you remove the ' " ' signs. (don't know their name in english ;-) )

So, I wish you luck... I have to do some work now ;-)

cheers


You can fool some of the people all of the time, and all of the people some of the time, but you can not fool all of the people all of the time. Abraham Lincoln - http://www.ae911truth.org/ - http://www.freedocumentaries.org/

Share this post


Link to post
Share on other sites

thanks :-)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0