I'm trying to run a bat file located at c:\sort2folder.bat from the context menu of the folder background that I am currently in ,IE H:\videos, using the code below.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\Sort 2 Folder]
#="&Sort 2 Folder"
[HKEY_CLASSES_ROOT\Directory\Background\shell\Sort 2 Folder\command]
#="C:\\sort2folder.bat \"%V\""
The problem is that it seems to be running the sort2folder.bat file in the c: directory instead of changing to the current directory that I'm in.
Related
I have a batch file that's in my desktop and it works properly when I execute it using double click. But when I execute it using a task scheduler or run as administrator, the working directory changes to C:\Windows\system32 and it doesn't work properly.
What's the reason why it happens and how do I retain the working directory?
Put this line at the top of your bat file:
pushd %~dp0
See this post for details
Difference between "%~dp0" and ".\"?
Is there a way to set the default folder when clicking File>Open?
MARS always shows the user folder for me (home/diogo/).
It only shows another folder when I have already a file opened (shows that file directory).
If you are on linux open the terminal, navigate to the desired folder and launch mars with java -jar PathToMarsJar
When I execute the package, it opens up the 7Zip window. I want that the files are unzipped to the 'WorkingDirectory' New folder. No error is thrown. The 7Zip window opens up and it can be seen that the desired file has NOT been unzipped. I have included screenshots for reference.
enter image description here
enter image description here
7zFM.exe is the GUI file manager. I tried with 7z.exe as well but that too didn't work. I had other archive tools apart from 7Zip installed in my system like BreeZip, WinRAR. The folder which I was trying to unzip was zipped using BreeZip.
I watched few youtube videos where, for unzipping they used compressed files like the one shown in SS1 unlike the ones compressed with WinRAR or BreeZip. Following the same lines, I uninstalled BreeZip and WinRAR and tried unzipping the folder given in SS1 with Execute Process Task task but it still didn't work(I might be missing something for sure but unable to get to it).
Then I tried working the same with 'Script Task' and it worked successfully.
Attachments:
SS1 zipped folder- showing the compressed file which I unzipped using 7Zip
enter image description here
script task SS
enter image description here
I need to create a .bat file in order to run my Blue Prism process via CMD.
The commands are as follows (in order):
cd C:\Program Files\Blue Prism Limited\Blue Prism Automate
AutomateC.exe /user umang abcd1234 /run MyDemoProcess
Pardon if my question looks too basic as I am new to this stuff.
In order to run any process from a batch file, please follow the below steps:
1) Open a notepad and type the below command :
"C:\Program Files\Blue Prism Limited\Blue Prism Automate\AutomateC.exe" /user umang abcd1234 /run "MyDemoProcess"
2) Save the file with .bat extension e.g. Test.bat. Once the saveAs window appears, please enter Test.bat in the FileName textbox and in SaveAs Type dropdown, please select All Files so that it takes the .bat extension.
3) Now whenever you will open the batch file it will trigger your process.
Note Please make sure your runtime resource is connected to the app server and you are able to see your runtime resource running otherwise the above batch file won't work
I have written a simple batch file mycmd.bat, to open up explorer. I've added the file in the appropriate path. The content of the file is:
explorer
Now I want to use this bat file to open up any directory. So I navigate to the required directory and run my command:
D:\MyFolder>mycmd .
If I have Visual Studio Code installed then if I wanted to open the directory with VS Code then I'd do:
D:\MyFolder>code .
I want similar approach for my custom command.
Now if I run D:\MyFolder>mycmd . it opens up my Libraries folder. Not the folder I am at right now which is D:\MyFolder.
(For me Libraries is the default folder that opens up when I open explorer by clicking the yellow explorer icon at my taskbar.)
You do not need a batch-file for that. Navigating to the directory and typing (into the commandline I assume you to take to navigate) explorer . opens the explorer view of that folder.
An alternative if you are running this in a batch-file you could also use explorer %cd%. The environmental variable cd stores the path of the current callers (Thanks for the correction by WasteD!) directory.
So it uses the value from where you called the file i.e. the directory you are currently in or after you used cd anotherFolder it will use this new path.
To change your "custom command" you could also add "%~1" to the same line explorer currently stands in:
explorer "%~1"
This will take the first argument of your batch-file -> in this case . without potential surreounding quotes and add it after the explorer command as first argument.