Autorun.inf cannot deal with the sub-folders with space in their folder name? - windows

I am trying to use an autorun.inf to run my executable file under a sub-folder with space in its folder name. Like this:
H:\
autorun.inf
FOLDER NAME 1
file.exe
FOLDER NAME 2
some other stuffs
If there's no space in the folder name, it works well. But if there are some, it's not work for me.
Is this a restrict? or I am doing something wrong?
My autorun.inf:
[autorun]
open=FOLDER NAME 1\Setup.exe
icon=FOLDER NAME 1\Setup.exe

With some trials I have found that pairs of double quotes are needed. Sounds strange though.
open=""FOLDER NAME 1\Setup.exe""

Expanding on from Sanjay's answer of using two sets of quotes, like
open=""FOLDER NAME 1\Setup.exe""
If you want your icon from the folder, you need to put a single set of quotes around the whole line. E.g.
icon="FOLDER NAME 1\Setup.exe,0"

My uninformed guess: use quotes.
[autorun]
open="FOLDER NAME 1\Setup.exe"
icon="FOLDER NAME 1\Setup.exe"

In addition to doing as Thomas suggests and using quotes, you can also use the short/"DOS" style names. Which are the first 6 letters of the name followed by a tilde (~) and then a number. So "FOLDER NAME 1" would usually become "FOLDER~1".

This also works:
open=.\FOLDER NAME 1\Setup.exe
edit: works for icon, NOT for open command...a bit strange!

Related

Windows Shorcuts with quoted command line parameters

I have a program shortcut on my desktop with the target set to:
"c:\folder\program.exe"
When drag'droping a folder on to this I get:
"c:\folder\program.exe" d:\myfolder
This used to work well for many years, but a newer version of the program only excepts paths with quotes like:
"c:\folder\program.exe" "d:\myfolder"
Windows automatically adds the quotes for paths with spaces, but not if the paths do not contain any spaces.
How can I force Windows to add the quotes or is there any easy way to change the target to enclose drag'dropped paths with quotes?
Thanx for reading, Needly
You can try to add an explicit parameter placeholder %1 in the target field:
"c:\folder\program.exe" "%1"
This should work since Windows does nothing else than to fill the drag&dropped file or folder path into %1 ("parameter one") or %2 etc. if a list of files/folders was dropped.
HTH, GL, HF :)

Latex - Bibtex/BibLatex - How can I include a file with space in the path?

I am using Mac and
\usepackage{natbib}
It seems that the space in the path caused problems, i.e. Box Sync.
\bibliography{/Users/c082213/Box Sync/AA_My_Papers/MyStats.bib}
I have tried to put them in double "", and it doesn't work on Mac. Is there anyway that we can fix this?
Many thanks!
one solution is to use a relative path.
If the .bib and the .tex file are in the same folder you can just write:
\bibliography{MyStats}
On the other hand, there are many other possible solutions to handle the problem with with spaces in the path. My suggestion is: avoid it to name folders or files with spaces. It will produce problems for some reasons.
I had the same issue with Box and it's default usage of spaces, so I created a soft link having no spaces:
ln -s "Box Sync" Boxsync
then I can use the bibliography command as usual.

open UNC path with spaces in windows explorer with perl

Hello stackoverflowers,
i'm afraid i can't figure out how to open an UNC path with spaces within Windows Explorer in perl.
Purpose is, i want the user to put a file within the path. To make it more comfortable, the path should open in explorer automatically. Which it does for any local drives.
The UNC path that should open is: \\srvr1\mean space dir
My code so far:
use strict
use warnings
my $sourceDir = "\\\\srvr1\\mean space dir";
system("start $sourceDir");
Which gives the error: "Win can't access \\srvr1\mean."
Ok, so i tried to quote the string:
my $sourceDir = "\\\\srvr1\\\"mean space dir\"";
Which lead to: "Win can't access \\srvr1\"mean space dir"."
Next thing i tried was:
my $sourceDir = q{"\\\srvr1\\mean space dir"}
Which lead to an cmd window being opened with the correct path within the title?!
Is maybe the system call itself wrong?
I really appreciate any help. Thanks.
The second form is correct, but then you have to account for the fact that the start command treats its first quoted argument as a window title. If you want to start a quoted path, you need to give a window title argument too (the empty string is fine).
Like so:
my $sourceDir = q{\\\\srvr1\\mean space dir};
system(qq{start "" "$sourceDir"});
For this kind of thing the array style system call is a good fit. You don't need to worry about quoting the path or escaping as much.
$path = '\\\\srvr1\mean space dir';
system('start', '', $path);
Quoting (or forgetting to quote) paths in system calls is a significant source of bugs where I've worked. A habit of doing it as above means you never need to worry about it.

Change several windows folder names at once

I have to rename several folders. The old folders were randomly named, and the new names allow for a consistent naming protocol. i have reconciled the existing folders with the list of new names, but there are hundreds of folders to rename and to do it manually will take forever.
the old name and new name are generally very different. for example:
old: john l,smth new: smith_john_04082013
so what i would like to do is place a list of the old names in one part of a program and the list of new names in another part, and then loop down the list of folders renaming them until the last one is done.
for example
john l,smth (to) smith_john_04082013
mary-jones 42nd street (to) jones_mary_03122013
wil-h-davis (to) davis_william_02122012
etc
i know how to use the rename command in dos, but all that 'seems' to do is just change the name of of one directory, ie rename "john l,smth" "smith_john_04082013"
i tried doing something like:
rename "john l,smth" "smith_john_04082013"; "mary-jones 42nd street" "jones_mary_03122013"; "wil-h-davis" "davis_william_02122012"
the concept being maybe using a separator was the trick to a multiple rename, but that didn't work either.
if anyone knows how to do this that would be very helpful.
TIA
Just create a batch file (plain text file with a .bat extension, like rename_folders.bat), and list each operation as a single line:
ren "john l,smth" "smith_john_04082013"
ren "mary-jones 42nd street" "jones_mary_03122013"
ren "wil-h-davis" "davis_william_02122012"
(ren is the short name for rename, which saves a little typing.)
Once you have all the lines in the file, save it in the folder where you want it to run, open a command prompt in that folder, and just run the batch file (the .bat extension is optional when you run it, as it's one of the known executable file extensions):
C:\YourBaseFolder>rename_folders
or
C:\YourBaseFolder>rename_folders.bat

Placing the semicolon in the Windows PATH environment variable

Where should the trailing semicolon in the Windows PATH environment variable be placed when adding a new folder?
Is it
[oldPATH];C:\My Folder
[oldPATH]C:\My Folder;
[oldPATH];C:\My Folder;
?
I saw different practices.
This is not really a syntax thing, actually. The correct answer here is: Place the semicolon so the result is a valid PATH.
This usually means one of the following:
set PATH=%PATH%;C:\Foo\Bar
set PATH=C:\Foo\Bar;%PATH%
because usually PATH doesn't end in a semicolon, so you have to add one appropriately to not mangle an existing path in it.
Just look at how PATH looks like and consider what you need to do if you add another path. This means you have to add a separator (the semicolon) and the path itself.
The first one. At least thats what Windows does on mine, so if Windows does it that way then that will probably be best :)
The first one:
[oldPATH]; C:\My Folder.
If you want to be sure, you can use the formula:
"%PATH%;C:\My Folder".
If it is only to execute something in, for example, a BAT script, use:
SET PATH "%PATH%;C:\My Folder".
(this one will be working just as a temporal variable)
To add a permanent User Enviroment Variable through command line:
SETX PATH "%PATH%;C:\My Folder".
Your oldPATH may end with semicolon, so when using fourth style [newPath];[OldPath] you don't add double semicolons.
path=%cd%;%path%
Note that windows doesn't care whether you write commands upper- or lowercase.

Resources