Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Fixed MKSC and @SCINFO fail when LNK file name starts with space

May
3,515
5
I have some shortcut files whose name starts with space character - done for both vertical alignment and for sorting purposes. Apparently both MKSC and @SWINFO build a full path using trimmed filenames, even when the command quotes the name. The problem only occurs if the first character of the quoted string is space; if the full path is passed (quoted, of course) it's OK.
 
I had no idea that it was even possible to have a filename beginning with a space. I would have bet against it.

I've uploaded a new build. If you want a space at the start of an argument, you're going to have to quote it -- even in a function.
 
Thanks! It does the job perfectly! I used it to update a shortcut (changing only the "argument" field) that changes both screen resolution and screen saver timeout and exits - using two other commands of UIstuff. Three altogether in just one usage.

BTW, in order to have "%+" in the "argument" field of the shortcut, I had to use "... %%+ ..." in the /a: field of MKSC. Without doubling the % signs it was expanded by the parser to the CommandSep character of the TCC instance executing MKSC, instead of being inserted into the link as the pseudovariable representing CommandSep.
 
BTW, in order to have "%+" in the "argument" field of the shortcut, I had to use "... %%+ ..." in the /a: field of MKSC. Without doubling the % signs it was expanded by the parser to the CommandSep character of the TCC instance executing MKSC, instead of being inserted into the link as the pseudovariable representing CommandSep.

That happens before my code ever sees it, as you can verify by inserting an ECHO before the real command. So yeah, you'll have to double the percent sign, or put it in strong quotes or whatever.
 
As moderator, you might wish to change "Bug" to "Fixed". As the OP I should be able to do that... and it is less appropriate for the author of code to declare it fixed than for the one who reported it. WAD would be a different proposition.
 
Still there is a minor problem - shortcut files on mapped network drives pointing to some system applications "cannot resolve file". Internal SHORTCUT command fails, too. The two I use that failed are "Add or Kill" and "Display" (i.e., window characteristics), both on the "All Users" desktop. In the user desktop several work correctly: link to IE's option dialog (use it to clear IE cache), control panel, date and time, network connections. I am not sure this can be solved. BTW, both the local and the mapped network drive use WinXP SP3, NTFS.
 
Still there is a minor problem - shortcut files on mapped network drives pointing to some system applications "cannot resolve file". Internal SHORTCUT command fails, too. The two I use that failed are "Add or Kill" and "Display" (i.e., window characteristics), both on the "All Users" desktop. In the user desktop several work correctly: link to IE's option dialog (use it to clear IE cache), control panel, date and time, network connections. I am not sure this can be solved. BTW, both the local and the mapped network drive use WinXP SP3, NTFS.

I'm afraid I don't understand this. Can you give me instructions to create such a file?
 
Open Control Panel. Right click on the application you want on the desktop. Select "Create shortcut". When it complains "... not ... here. ... desktop?" select Yes. Now you have a desktop shortcut to e.g. "Network Connections". The shortcut can now be modified, e.g., change its name, add a hotkey, etc. Note that SHORTCUT, MKSC and @SCINFO handle all shortcuts on local drives (intended to be run on the local system) perfectly; it is only some (but not all) shortcuts on mapped network drives (designed to be run only on the remote system) fail. Finding a solution is not essential for me; I can do anything I desire on the other system by walking a few steps. However, others who do not have physical access to remote systems may be interested (though they probably have remote access to the desktops and can deal with the issues without getting out of their chairs).
 
If the shortcut is pointing to something on the remote system, I doubt that there's much I can do about it if it doesn't work. Sorry.
 
As expected. Not a problem. Thanks for a very useful toolkit. Now if I could figure out how the same .INI directives specifying paths can be used on different systems with different drive letters...
 
Suggestion for @SCREENRES: Like @SCINFO, accept letter codes used in SCREENRES command instead of magic numbers (or even full words)

Suggestion for SCREENRES command and @SCREENRES function: report 1Hz as "default refresh rate", not as number

Suggestions for SCREENRES command:
- option to suppress final report without redirecting to NUL.
- highlight the random number that must be reentered to verify screen parameter change
- documentation: add the words "random" and "same" so text will read:
"will prompt you to enter a three-digit random number to verify that you can still read the display. If you don’t enter the same number"

add word "random" changing "enter a three-digit number to verify" to "enter a random three-digit number to verify"
 
Suggestion for @SCREENRES: Like @SCINFO, accept letter codes used in SCREENRES command instead of magic numbers (or even full words)

Suggestion for SCREENRES command and @SCREENRES function: report 1Hz as "default refresh rate", not as number

Suggestions for SCREENRES command:
- option to suppress final report without redirecting to NUL.
- highlight the random number that must be reentered to verify screen parameter change
- documentation: add the words "random" and "same" so text will read:
"will prompt you to enter a three-digit random number to verify that you can still read the display. If you don’t enter the same number"

add word "random" changing "enter a three-digit number to verify" to "enter a random three-digit number to verify"
I suggest instead of "random", the word "arbitrary".
 
Suggestion for @SCREENRES: Like @SCINFO, accept letter codes used in SCREENRES command instead of magic numbers (or even full words)

Suggestion for SCREENRES command and @SCREENRES function: report 1Hz as "default refresh rate", not as number

Suggestions for SCREENRES command:
- option to suppress final report without redirecting to NUL.
- highlight the random number that must be reentered to verify screen parameter change
- documentation: add the words "random" and "same" so text will read:
"will prompt you to enter a three-digit random number to verify that you can still read the display. If you don’t enter the same number"

add word "random" changing "enter a three-digit number to verify" to "enter a random three-digit number to verify"

Okay, I have a new build up for you.
 
Back
Top