Redirecting filepaths or binding paraameters to an EXE

ThelastCanadian

New member
Local time
5:34 PM
Messages
29
Hello,

I was wondering if anyone knew of any methods or tools to do this. I am looking to make it so that chrome constantly runs with its --user-data-dir and --cache flags. They are different from the defaults, obviously and I was looking for a less clumsy manner than to use a a directory junction.

Is there a way to make it so that chrome.exe always starts with these parameters? I can use shortcuts for a lot, but programs like skype refuse to oblige me.

I've tried editing the registry for the types of files chrome opens, but it's tedious and just not worth the trouble. Is there a cleaner solution?

Worst case scenario, I might write a windowless VB program and name it chrome.exe (in the same dir) that opens the real thing with the proper parameters, but I'm wondering if there's something a bit less unorthodox and more direct?

Perhaps a way to bind application parameters to the .exe?

I have also, out of curiosity, tried MKLINK for a symbolic directory changing filetypes (chrome.exe redirects to a LNK with the parameters) but for reasons I probably should have anticipated, this is obviously not working. Perhaps I'm on the right track, however....

Many thanks for any suggestions or assistance.

Or should I just leave it on my SSD and get over the writes?
 

My Computer My Computer

At a glance

Win7 Home Premium 64x
OS
Win7 Home Premium 64x
Afaik, giving parameters in a shortcut properties window works for chrome. As long as it is being launched from the shortcut anyway.

Anyway, MKLINK works fine if you use it to simply redirect stuff from a folder to another and not to pull shenanigans on an exe.

Copy-pasting someone elses's work from here:
Code:
mklink /D "C:\Users\Bapa\AppData\Local\Google\Chrome\User Data\Default\Cache" "D:\chrome_cache"

Let's break it down.
The first term, "mklink" is the name of the command line program we'll be using.
/D is a command-line switch to tell it to link to a directory.
The first parameter, in quotation marks, is the location we want our symbolic link to be placed.
The last parameter is the location we want to link to.

Note: The file system that you want to place the symbolic link on must be NTFS.
This
Code:
mklink /d "C:\Users\<account>\AppData\Local\Google\Chrome\UserData\Default" "C:\YourPath\Default"
should do the trick for the user data folder.

Or should I just leave it on my SSD and get over the writes?
Won't impact its lifespan that much. Most SSDs are supposed to last decades with 2-4 GB written per day, every day.
 

My Computer My Computer

At a glance

Win 7 Pro 64-bit 7601AMD Phenom 9650 QuadCore, revision DR-B35 GB yes I run 2x 2GB and 1x 1GB, different b...NVIDIA GeForce 9800 GT 512 Mb, unknown manufa...
Computer type
PC/Desktop
Computer Manufacturer/Model Number
custom built
OS
Win 7 Pro 64-bit 7601
CPU
AMD Phenom 9650 QuadCore, revision DR-B3
Motherboard
ASUS M4A78
Memory
5 GB yes I run 2x 2GB and 1x 1GB, different brand, spank me.
Graphics Card(s)
NVIDIA GeForce 9800 GT 512 Mb, unknown manufacturer.
Sound Card
Crappy Realtek Integrated Audio
Monitor(s) Displays
Fujitsu Siemens P19-3P
Screen Resolution
1280 x 1024 x 32 bits @ 60 Hz Oh yeah, 4:3 rocks!
Hard Drives
(1) MAXTOR S TM3320613AS SATA Disk Device (2) STM35004 18AS SATA Disk Device (3) TOSHIBA USB 2.5"-HDD
PSU
whatever, around 450w
Case
Scavenged from old company PC, 10+ years old
Cooling
CPU fan, GPU fan, case fan, nothing fancy
Keyboard
Microsoft, PS/2, white.
Mouse
Optical, logitec.
Internet Speed
effective max speeds: 70-ish kB/s down 30-ish kB/s up
Antivirus
Avira, free edition.
Browser
Firefox with FXChrome to make it look like Google Chrome :P
Other Info
Was discarded by previous owner due to "horrible performance".
Was running Win Xp from a IDE drive. Yeah. Was a pain.
SATA II drive and Win7 and it zips away! Yay!
While I appreciate the response - I did specifically mention that I was looking to avoid using directory junctions/symbolic links if at all possible. I also mentioned that shortcuts will not work since they are only a localized solution and I need a global one.

I'm probably stuck just using my chrome.exe VB workaround. I'm thinking on an SSD it shouldn't impact the start of the program that heavily; I was just looking to avoid installing VB...
 

My Computer My Computer

At a glance

Win7 Home Premium 64x
OS
Win7 Home Premium 64x
What you are talking about is common practice on systems that directly support aliases in the shell. One common example is the ls command in Linux. Typically it has params tacked on for formatting the output so that you just have to type
ls filepattern
in the shell command prompt.

You can do similar stuff with .cmd files.
for example,
chrome.cmd file with
c:\program files\chrome\chrome.exe --param1 --param2 %*
(the %* means to substitute the entire command tail. Any urls will be passed to chrome)
 
Last edited:

My Computer My Computer

At a glance

Windows 7 32 bitAMD 5200+ dual core2 GBNVidia GeForce 6150SE 128 MB
Computer Manufacturer/Model Number
HP Media Center
OS
Windows 7 32 bit
CPU
AMD 5200+ dual core
Memory
2 GB
Graphics Card(s)
NVidia GeForce 6150SE 128 MB
Monitor(s) Displays
CRT
Screen Resolution
1280x1024
Hard Drives
500 GB Sata internal :

SIIG USB 3.0 docking stations w/WD Caviar Black 6 Gb/s drives
Keyboard
PS/2
Mouse
PS/2 Wheel Mouse
Other Info
SIIG USB 3.0 PCIexpress card.
What you are talking about is common practice on systems that directly support aliases in the shell. One common example is the ls command in Linux. Typically it has params tacked on for formatting the output so that you just have to type
ls filepattern
in the shell command prompt.

You can do similar stuff with .cmd files.
for example,
chrome.cmd file with
c:\program files\chrome\chrome.exe --param1 --param2 %*
(the %* means to substitute the entire command tail. Any urls will be passed to chrome)

That said, how do I make this cmd a default? The issue is that I need a consistent way of opening chrome with these parameters that will be the system default.

As far as I understand, using a .cmd like so will simply accomplish what a shortcut otherwise would. That's all well and good if I click the cmd (or a shortcut to it) in order to open it - but I basically want to set it so anytime the system would feel compelled to open chrome.exe, it will instead open chrome.exe with these parameters.

For instance, skype needs this to open chrome properly by default, otherwise, it just opens a chrome window without the parameters. The closest I've gotten is hacking the registry file entries for things like .html so that the program it points to is chrome.exe --user-data-dir, etc. Like so:

Code:
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\ChromeHTML\shell\open\command]
@="\"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe\" --user-data-dir=D:\\Chrome \"%1\""

[HKEY_CLASSES_ROOT\FTP\SHELL\OPEN\COMMAND]
@="\"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe\" --user-data-dir=D:\\Chrome \"%1\""

[HKEY_CLASSES_ROOT\http\SHELL\OPEN\COMMAND]
@="\"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe\" --user-data-dir=D:\\Chrome \"%1\""

[HKEY_CLASSES_ROOT\https\SHELL\OPEN\COMMAND]
@="\"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe\" --user-data-dir=D:\\Chrome \"%1\""

[HKEY_CURRENT_USER\Software\SHELL\Classes\FTP\shell\open\COMMAND]
@="\"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe\" --user-data-dir=D:\\Chrome \"%1\""

[HKEY_CURRENT_USER\Software\SHELL\Classes\http\shell\open\COMMAND]
@="\"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe\" --user-data-dir=D:\\Chrome \"%1\""

[HKEY_CURRENT_USER\Software\SHELL\Classes\https\shell\open\COMMAND]
@="\"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe\" --user-data-dir=D:\\Chrome \"%1\""

However, when I use CCleaner, or the program updates, or just something screwy happens, this all breaks down. Basically, what I'm trying to accomplish is this:

1. Click chrome or link from IM
2. OS receives call to open this application
3. Instead of opening just CHROME.exe, the OS call results in one of two things:
3a. It recognizes the exe as binded to --user-data-dir (etc.) or
3b. It calls "chrome.exe" which redirects to the real chrome.exe with these parameters, sort of like a shortcut
4. Chrome opens by default in all instances (exempting special shortcut parameters for other circumstances) with these parameters.
 

My Computer My Computer

At a glance

Win7 Home Premium 64x
OS
Win7 Home Premium 64x
If you make the .cmd the "system default" how would you then launch chrome.exe without entering an endless loop? If chrome.exe is going to be called using the full path from myriad programs, then there is no smooth way I know of to accomplish it.

Either that or see if there's a Windows replacement shell available that supports aliases.
Also I'd ask on the chromium groups(used to be on google groups but has moved to its own server.)
 

My Computer My Computer

At a glance

Windows 7 32 bitAMD 5200+ dual core2 GBNVidia GeForce 6150SE 128 MB
Computer Manufacturer/Model Number
HP Media Center
OS
Windows 7 32 bit
CPU
AMD 5200+ dual core
Memory
2 GB
Graphics Card(s)
NVidia GeForce 6150SE 128 MB
Monitor(s) Displays
CRT
Screen Resolution
1280x1024
Hard Drives
500 GB Sata internal :

SIIG USB 3.0 docking stations w/WD Caviar Black 6 Gb/s drives
Keyboard
PS/2
Mouse
PS/2 Wheel Mouse
Other Info
SIIG USB 3.0 PCIexpress card.
One could use the approach of renaming the exe to something like chrome_real.exe and call that from the .cmd if it wasn't for the multiple exe launch chrome uses. It would work with firefox as it only has one exe in memory at a time. chromium discussion group may have some better ideas. I'm sure people are sticking on the params in some automated fashion.
 

My Computer My Computer

At a glance

Windows 7 32 bitAMD 5200+ dual core2 GBNVidia GeForce 6150SE 128 MB
Computer Manufacturer/Model Number
HP Media Center
OS
Windows 7 32 bit
CPU
AMD 5200+ dual core
Memory
2 GB
Graphics Card(s)
NVidia GeForce 6150SE 128 MB
Monitor(s) Displays
CRT
Screen Resolution
1280x1024
Hard Drives
500 GB Sata internal :

SIIG USB 3.0 docking stations w/WD Caviar Black 6 Gb/s drives
Keyboard
PS/2
Mouse
PS/2 Wheel Mouse
Other Info
SIIG USB 3.0 PCIexpress card.
I don't quite think what I'm looking to do has been understood. I opted to use my original plan of writing a .exe and replacing the chrome file. That way it will call the same, but the actual application will open as it should.
 

My Computer My Computer

At a glance

Win7 Home Premium 64x
OS
Win7 Home Premium 64x
Registry edits and making an exe won't work in the long run as when the damn thing updates (and it does it silently witout giving you any warning, as most google stuff) it's going to return like default situation.

I still don't understand why you don't want to do symbolic links. They work fine and will keep working even in case it updates as it is a system-level change, fully invisible to applications.

I think the only way to get it to work like you need it without symlinks or black magic is to get it to run in its own virtual environment, but a full blown virtualbox is a bit unwieldy.
I think that Sandboxie might be what you are looking for and it allows any program to do what you ask (run with all its stuff in a single place). Also PortableApps have a portable version of Chrome (that again runs in its own folder without writing stuff anywhere else. The same concept Sandboxie uses, keeping apps locked down in their own little semi-virtual environment), but I don't know if it is able to be set as the default broswer (but in this case a registry edit and/or making a fake exe pointing to it will work fine as any Chrome update is done inside its little box anyway).

Neither should have any impact on performance unless your processor is an Atom.
 
Last edited:

My Computer My Computer

At a glance

Win 7 Pro 64-bit 7601AMD Phenom 9650 QuadCore, revision DR-B35 GB yes I run 2x 2GB and 1x 1GB, different b...NVIDIA GeForce 9800 GT 512 Mb, unknown manufa...
Computer type
PC/Desktop
Computer Manufacturer/Model Number
custom built
OS
Win 7 Pro 64-bit 7601
CPU
AMD Phenom 9650 QuadCore, revision DR-B3
Motherboard
ASUS M4A78
Memory
5 GB yes I run 2x 2GB and 1x 1GB, different brand, spank me.
Graphics Card(s)
NVIDIA GeForce 9800 GT 512 Mb, unknown manufacturer.
Sound Card
Crappy Realtek Integrated Audio
Monitor(s) Displays
Fujitsu Siemens P19-3P
Screen Resolution
1280 x 1024 x 32 bits @ 60 Hz Oh yeah, 4:3 rocks!
Hard Drives
(1) MAXTOR S TM3320613AS SATA Disk Device (2) STM35004 18AS SATA Disk Device (3) TOSHIBA USB 2.5"-HDD
PSU
whatever, around 450w
Case
Scavenged from old company PC, 10+ years old
Cooling
CPU fan, GPU fan, case fan, nothing fancy
Keyboard
Microsoft, PS/2, white.
Mouse
Optical, logitec.
Internet Speed
effective max speeds: 70-ish kB/s down 30-ish kB/s up
Antivirus
Avira, free edition.
Browser
Firefox with FXChrome to make it look like Google Chrome :P
Other Info
Was discarded by previous owner due to "horrible performance".
Was running Win Xp from a IDE drive. Yeah. Was a pain.
SATA II drive and Win7 and it zips away! Yay!
Pity. Linux has so many fun things to do but none of the critical functionality I need.

Yea, I'm probably stuck using MKLINK. I kind of figured that out after I accidentally my user profile.

Edit: MKLINK doesn't hold up in a ramdisk. At any rate, I tested it and for the purposes and trouble I've been through the results are simply not there. It loads no faster than my browser can display the page to begin with, so.... HDD or RAM doesn't matter.
 
Last edited:

My Computer My Computer

At a glance

Win7 Home Premium 64x
OS
Win7 Home Premium 64x
Did you try sandboxie?
 

My Computer My Computer

At a glance

Win 7 Pro 64-bit 7601AMD Phenom 9650 QuadCore, revision DR-B35 GB yes I run 2x 2GB and 1x 1GB, different b...NVIDIA GeForce 9800 GT 512 Mb, unknown manufa...
Computer type
PC/Desktop
Computer Manufacturer/Model Number
custom built
OS
Win 7 Pro 64-bit 7601
CPU
AMD Phenom 9650 QuadCore, revision DR-B3
Motherboard
ASUS M4A78
Memory
5 GB yes I run 2x 2GB and 1x 1GB, different brand, spank me.
Graphics Card(s)
NVIDIA GeForce 9800 GT 512 Mb, unknown manufacturer.
Sound Card
Crappy Realtek Integrated Audio
Monitor(s) Displays
Fujitsu Siemens P19-3P
Screen Resolution
1280 x 1024 x 32 bits @ 60 Hz Oh yeah, 4:3 rocks!
Hard Drives
(1) MAXTOR S TM3320613AS SATA Disk Device (2) STM35004 18AS SATA Disk Device (3) TOSHIBA USB 2.5"-HDD
PSU
whatever, around 450w
Case
Scavenged from old company PC, 10+ years old
Cooling
CPU fan, GPU fan, case fan, nothing fancy
Keyboard
Microsoft, PS/2, white.
Mouse
Optical, logitec.
Internet Speed
effective max speeds: 70-ish kB/s down 30-ish kB/s up
Antivirus
Avira, free edition.
Browser
Firefox with FXChrome to make it look like Google Chrome :P
Other Info
Was discarded by previous owner due to "horrible performance".
Was running Win Xp from a IDE drive. Yeah. Was a pain.
SATA II drive and Win7 and it zips away! Yay!
The other thing you could do is make sure chrome.exe is already running when you log in. Usually if a program tries to launch another copy, the already running copy will open another tab.. if you have that option set(open new tab rather than open new window.)

Just start chrome with the params on login by putting the custom shortcut in the Startup folder.
 

My Computer My Computer

At a glance

Windows 7 32 bitAMD 5200+ dual core2 GBNVidia GeForce 6150SE 128 MB
Computer Manufacturer/Model Number
HP Media Center
OS
Windows 7 32 bit
CPU
AMD 5200+ dual core
Memory
2 GB
Graphics Card(s)
NVidia GeForce 6150SE 128 MB
Monitor(s) Displays
CRT
Screen Resolution
1280x1024
Hard Drives
500 GB Sata internal :

SIIG USB 3.0 docking stations w/WD Caviar Black 6 Gb/s drives
Keyboard
PS/2
Mouse
PS/2 Wheel Mouse
Other Info
SIIG USB 3.0 PCIexpress card.
Did you try sandboxie?

MKLINK does not work for ramdisks very well it seems. Regardless, I went and compared the loading times for the two (HDD v. Ramdisk) and the difference is extremely marginal. I imagine the browser simply cannot render these any quicker.

Therefore, I will carry on with the easiest method, MKLINK + standard HDD.
 
Last edited:

My Computer My Computer

At a glance

Win7 Home Premium 64x
OS
Win7 Home Premium 64x
Back
Top