Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: How to create a shortcut to batch file one folder up

15 Jan 2016   #1
fhutt

Windows 7 Home Premium and Ultimate
 
 
How to create a shortcut to batch file one folder up

Hello
I have been trying to create a shortcut to launch a batch file one folder up from the shortcut location.
I have been able to do this using and intermediate batch file in the same folder as the shortcut as follows:
Intermediate.bat:
@echo off
FOR %%V IN ("%~dp0..\") DO set curdrv=%%~dpV
start "" %curdrv%Oneup.bat

And the shortcut target is:
%windir%\system32\cmd.exe /c Intermediate.bat

and the 'Start in' is left blank.

This way I can move these folders anywhere on the drive or another drive and the shortcut still works.
However, I would like to leave out the Intermediate.bat file and launch the Oneup.bat directly. I tried:
%windir%\system32\cmd.exe /c FOR %%V IN ("%~dp0..\") DO set curdrv=%%~dpV && start "" %curdrv%Oneup.bat
in the Target of the shortcut, but it doesn't work.
Is there some trick to getting this to work?
Thanks


My System SpecsSystem Spec
.
18 Jan 2016   #2
Pyprohly

Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
 
 

Hey Fhutt,

You can do the following for your shortcut's target.
Code:
cmd /c "start "" "..\Oneup.bat""
And ensure that the 'Start in' field in the shortcut's Properties pane is empty.

Alternatively, you may instead want to look in to symbolic links which do support relative paths.
My System SpecsSystem Spec
18 Jan 2016   #3
fhutt

Windows 7 Home Premium and Ultimate
 
 

Thank you. This is what I was looking for.
Maybe some of the quotes would not be needed:
cmd /c start "" "..\Oneup.bat"
My System SpecsSystem Spec
.

Reply

 How to create a shortcut to batch file one folder up




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
Remove "Create Shortcut" from file and folder context menu?
Hi Shawn, is there a way to remove "Create Shortcut" from the right-click context menu on a file/folder?
Customization
batch&task to create new folder and move all desktop file to it
hi so work in an recruitment office and im trying to create a batch file that the computers can run on a schedule to create a folder with that days date on it and move all files from the desktop to that folder( also created on the desktop), i want the code to only move files and leave folders and...
General Discussion
Shortcut - Create for a File, Folder, Drive, or Program in Windows
How to Create a Shortcut of a File, Folder, Drive, or Program in Vista, Windows 7, and Windows 8 A shortcut is a link to an item (such as a file, folder, drive, or program) on your computer. You can create shortcuts and then place them in a convenient location so that you can easily access the...
Tutorials
Batch File that grabs file names from folder to insert into batch file
Ok I'm totally at a loss on how to word this so I'm just going to write it out the best that I can... :confused: First I have a batch file that I'm writing that will convert mp4 files to mp3 files (I have a lot) for a buddies band using ffmpeg. Here's the code that I'm using: ffmpeg -i...
General Discussion
How to create a current date folder using batch file?
Hi I am using following batch file for cleaning the desktop and also for taking backup of desktop: @echo off set curr_date=%DATE:~10,4%-%DATE:~4,2%-%DATE:~7,2% mkdir "%USERPROFILE%\My Documents\backup\%curr_date%_backup"
General Discussion
Batch file to create a folder with name of the time.
I'm trying to write a batch file that when run creates a folder named "Backup" followed by the time it was created, and then copies files to that folder. When I run md "C:\Users\MasterControlProgram\Documents\MC Server With Backup\Backups\Backup %DATE%\" xcopy /e /v /y...
Backup and Restore


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 02:10.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App