# Create a batch file

**URL:** <https://forum.rclone.org/t/create-a-batch-file/48130>\
**Category:** Help and Support\
**Created:** [October 9, 2024, 6:04am UTC](https://forum.rclone.org/t/create-a-batch-file/48130 "2024-10-09T06:04:04Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pak](https://forum.rclone.org/letter_avatar_proxy/v4/letter/p/4bbf92/32.png) [@Pak](https://forum.rclone.org/u/Pak)\
**Post date:** [October 9, 2024, 6:04am UTC](https://forum.rclone.org/t/create-a-batch-file/48130/1 "2024-10-09T06:04:04Z")

</div>

Hello there I am new to rclone and using it successfully but I would like to automate much better my moving of files.  
Let me explain please, I am completely newbie.

First thing : I run rclone on windows using the linux WSL and it works great.

I have a remote cloud that I was able to setup that I named Cloud1.

I use the following command when I want to move files from a share folder of the cloud to my local pc (opening Unbuntu with admin) :

rclone move cloud:share /home/local -v -P

This command is working great but I would like to add two things :

1. Move the files to D:/Pictures instead of home.
2. Save this routine into a bat file that i would execute from windows I guess by double clicking on the bat file it would open Unbuntu and run the move command in background.

I searched in this forum but didn't find anything, I know I am very new to this so excuse the silly question in case.

Thank you.

---

<div class="post-metadata">

**Author:** ![asdffdsa](https://forum.rclone.org/letter_avatar_proxy/v4/letter/a/848f3c/32.png) [@asdffdsa](https://forum.rclone.org/u/asdffdsa)\
**Post date:** [October 9, 2024, 12:41pm UTC](https://forum.rclone.org/t/create-a-batch-file/48130/2 "2024-10-09T12:41:17Z")

</div>

welcome to the forum,

on windows,

1. create a text file with extension of `.sh`
2. create a shortcut pointing to the `.sh` file
3. double-click the shortcut to run the script

#### c:\data\rclone\doit.sh

```auto
# which user is running the script
whoami

# move files
rclone move cloud:share /mnt/d/Pictures -vv -P --dry-run

#pause the script to view the output
read -p "pause"

```

#### c:\data\rclone\doit.lnk

set target to  
`c:\windows\system32\wsl.exe /mnt/c/data/rclone/doit.sh`

* * *

> [@Pak](#):
>
> opening Unbuntu with admin :

not sure what that means?  
in your case:

- on windows, no need to run the script with admin privileges
- on wsl, no need to run the script as root user

---

<div class="post-metadata">

**Author:** ![Pak](https://forum.rclone.org/letter_avatar_proxy/v4/letter/p/4bbf92/32.png) [@Pak](https://forum.rclone.org/u/Pak)\
**Post date:** [October 10, 2024, 5:24am UTC](https://forum.rclone.org/t/create-a-batch-file/48130/3 "2024-10-10T05:24:15Z")

</div>

Thanks for the help. I have a few questions, just curious and learning...

- what is the purpose of this :  
#pause the script to view the output  
read -p "pause"
- you store the script into c:\data\rclone\ but actually I don't have such a folder, by running Unbuntu on Windows where should I store the script please ?
- I wrote run as admin because when I used to do it manually, I right click on the unbuntu icon and run as admin from windows environment.

---

<div class="post-metadata">

**Author:** ![kapitainsky](https://forum.rclone.org/user_avatar/forum.rclone.org/kapitainsky/32/14450_2.png) [@kapitainsky](https://forum.rclone.org/u/kapitainsky)\
**Post date:** [October 10, 2024, 6:07am UTC](https://forum.rclone.org/t/create-a-batch-file/48130/4 "2024-10-10T06:07:51Z")

</div>

> [@Pak](#):
>
> what is the purpose of this :  
> #pause the script to view the output  
> read -p "pause"

You have purpose explained in the comment... Try without to see difference.

> [@Pak](#):
>
> you store the script into c:\data\rclone\ but actually I don't have such a folder, by running Unbuntu on Windows where should I store the script please ?

Where it suits you the best... It is your system. Good idea is to have some specific location with your custom scripts.

> [@Pak](#):
>
> I wrote run as admin because when I used to do it manually, I right click on the unbuntu icon and run as admin from windows environment.

There is no need to run it as root unless you know what you are doing and you need it.

---

<div class="post-metadata">

**Author:** ![Pak](https://forum.rclone.org/letter_avatar_proxy/v4/letter/p/4bbf92/32.png) [@Pak](https://forum.rclone.org/u/Pak)\
**Post date:** [October 10, 2024, 6:14am UTC](https://forum.rclone.org/t/create-a-batch-file/48130/5 "2024-10-10T06:14:05Z")

</div>

Ok got it, I thought scripts were to be stored in one dedicated place.

Thank you !

---

<div class="post-metadata">

**Author:** ![asdffdsa](https://forum.rclone.org/letter_avatar_proxy/v4/letter/a/848f3c/32.png) [@asdffdsa](https://forum.rclone.org/u/asdffdsa)\
**Post date:** [October 10, 2024, 1:04pm UTC](https://forum.rclone.org/t/create-a-batch-file/48130/6 "2024-10-10T13:04:50Z")

</div>

> [@Pak](#):
>
> what is the purpose of this :  
> #pause the script to view the output  
> read -p "pause"

by default, the script would exit immediately, might miss the output of the rclone command.  
very helpful to catch syntax errors and other mistakes.

> [@Pak](#):
>
> you store the script into c:\data\rclone\ but actually I don't have such a folder, by running Unbuntu on Windows where should I store the script please ?

you can store them any place you want.  
make sure to change the shortcut's target to match.

> [@Pak](#):
>
> I wrote run as admin because when I used to do it manually, I right click on the unbuntu icon and run as admin from windows environment.

as you are new to scripts, very easy to make a mistakes.  
when you run scripts as admin/root, can do a lot more damage. in your case, should not be required.  
also, that is why i added `--dry-run` to your rclone command.

---

<div class="post-metadata">

**Author:** ![system](https://forum.rclone.org/uploads/default/original/2X/3/39ad3235f6ffec76ccd0c81616bd55697b4c300d.png) [@system](https://forum.rclone.org/u/system)\
**Post date:** [October 24, 2024, 10:51pm UTC](https://forum.rclone.org/t/create-a-batch-file/48130/7 "2024-10-24T22:51:39Z")

</div>

Closed on October 24, 2024, 10:51pm UTC

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
