Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: Slash character modified in a target field of a shortcut

25 views
Skip to first unread message

Gloops

unread,
Apr 29, 2013, 10:08:21 AM4/29/13
to
It seems the technical context can be useful to know : it is Windows XP
SP3 and Powershell 1.0

A test in VBS gave the same ...

Jolly polly

unread,
May 1, 2013, 2:42:45 AM5/1/13
to

"Gloops" <glo...@zailes.invalid.org> wrote in message
news:kllusl$kgm$6...@news.pasdenom.info...
> It seems the technical context can be useful to know : it is Windows XP
> SP3 and Powershell 1.0
>
> A test in VBS gave the same ...
>
>
A question

Are you trying to create a shortcut *or* a powershell script?

if the former is not good enough or possible, why the latter?

Gloops

unread,
May 2, 2013, 5:44:24 PM5/2/13
to
Hello,

I write a Powershell script that, after creating a new directory with
the date in its name, must do two things :

- open it in the explorer
- create a shortcut for it in the quick start folder, as the script is
not supposed to be launched each time the directory must be opened.

The first part is OK, but the target of the shortcut is modified for an
unknown reason.

If I create the shortcut by hand it runs OK, but then the script did not
do its job.

So, I modified the script to create now a one-line batch, instead of a
shortcut, and then the shortcut launches the batch, asynchronously. This
runs, but it is a bypass, as the real solution would be to be able to
write the shortcut properly, with /e, and not \e,.


Jolly polly

unread,
May 4, 2013, 2:59:26 PM5/4/13
to

"Gloops" <glo...@zailes.invalid.org> wrote in message
news:klumnp$9jr$1...@news.pasdenom.info...
I'm not sure I understand, how about...

$Drive = "C:\Users\"
$ShellExp = new-object -comObject Shell.Application
$ShellExp.explore($Drive)

does this help?

Gloops

unread,
May 4, 2013, 3:57:53 PM5/4/13
to
Jolly polly wrote, on 04th May 2013 20:59 UTC + 2 :
>> The first part is OK, but the target of the shortcut is modified for
>> an unknown reason.

By "The first part", I meant opening the explorer with
new-object -comObject "Shell.Application"

Remember :

$EXPLORER=NEW-OBJECT –Comobject “Shell.Application”
$EXPLORER.explore($cheminparent + "\" + $dest.Name);


This runs jolly good, this is why I said that the first part is OK.

It is with the shortcut then that I have a problem. Its target is
modified for an unknown reason.

So, I realize it was not clear with a bulleted list, so I am going to
try with an ordered one.
After creating a new directory, the script must :
1. Open it in the explorer
2. Create a shortcut that allows to do it again the day after.

Part 1 is OK, part 2 is buggy.


>
> I'm not sure I understand, how about...

perhaps not ;)

>
> $Drive = "C:\Users\"
> $ShellExp = new-object -comObject Shell.Application
> $ShellExp.explore($Drive)
>
> does this help?
>

only for part 1, it is what I did.

And I persist to think that replacing a shortcut by a new Powershell
script is not a good idea in itself, as Powershell takes about 30
seconds to load. A batch does not seem to create this problem, it is a
question of "nice code" : why adding another layer, whereas the shortcut
is supposed to open the directory directly ?



0 new messages