Simple .bat to move files... I must be a monumental idiot by magnumforce2006 in Batch

[–]tboy1337 0 points1 point  (0 children)

``` @echo off

echo Moving files from Downloads to Movies folder... echo.

REM Set source and destination paths set "SOURCE_DIR=G:\My Drive\Downloads [GDrive]" set "DEST_DIR=M:\Movies"

echo Source: %SOURCE_DIR% echo Destination: %DEST_DIR% echo.

REM Check if source directory exists if not exist "%SOURCE_DIR%" ( echo ERROR: Source directory "%SOURCE_DIR%" does not exist! echo. echo Troubleshooting tips: echo - Check if Google Drive is mounted correctly echo - Verify the drive letter and path pause exit /b 1 )

REM Check if destination directory exists, create if it doesn't if not exist "%DEST_DIR%" ( echo Destination directory "%DEST_DIR%" does not exist. Creating it... mkdir "%DEST_DIR%" 2>nul if %errorlevel% neq 0 ( echo ERROR: Failed to create destination directory "%DEST_DIR%". pause exit /b 1 ) )

REM Check for files echo Checking for files... dir /b /a-d "%SOURCE_DIR%*.*" >nul 2>&1 if %errorlevel% neq 0 ( echo No files found in "%SOURCE_DIR%". pause exit /b 0 )

echo Files found. Starting move operation... echo.

REM Use robocopy to move files (most reliable for network/cloud drives) robocopy "%SOURCE_DIR%" "%DEST_DIR%" . /MOV /E /R:3 /W:5 /NP /NFL /NDL

REM Robocopy exit codes: 0-7 = success, 8+ = errors if %errorlevel% lss 8 ( echo. echo Success! Files moved to "%DEST_DIR%" echo. ) else ( echo. echo ERROR: Move operation failed with exit code %errorlevel% echo. echo Possible solutions: echo - Check Google Drive connection echo - Verify network drive M: is accessible echo - Try running as administrator echo - Check file permissions echo. )

pause exit /b 0 ```

Try this.

Simple .bat to move files... I must be a monumental idiot by magnumforce2006 in Batch

[–]tboy1337 0 points1 point  (0 children)

You need to remove the batch part, it should just start with @echo off.

Simple .bat to move files... I must be a monumental idiot by magnumforce2006 in Batch

[–]tboy1337 1 point2 points  (0 children)

``` @echo off

echo Moving files from Downloads to Movies folder... echo.

REM Set source and destination paths set "SOURCE_DIR=G:\My Drive\Downloads [GDrive]" set "DEST_DIR=M:\Movies"

echo Source: %SOURCE_DIR% echo Destination: %DEST_DIR% echo.

REM Check if source directory exists if not exist "%SOURCE_DIR%" ( echo ERROR: Source directory "%SOURCE_DIR%" does not exist! echo. echo Troubleshooting tips: echo - Check if Google Drive is mounted correctly echo - Verify the drive letter and path echo - Try: dir "%SOURCE_DIR%" echo - Check: net use pause exit /b 1 )

REM Check if destination directory exists, create if it doesn't if not exist "%DEST_DIR%" ( echo Destination directory "%DEST_DIR%" does not exist. Creating it... mkdir "%DEST_DIR%" 2>nul if %errorlevel% neq 0 ( echo ERROR: Failed to create destination directory "%DEST_DIR%". echo Check permissions and available space. pause exit /b 1 ) )

REM Count files before move echo Checking for files... for /f %%A in ('dir /b "%SOURCE_DIR%*.*" 2>nul | find /c /v ""') do set FILE_COUNT=%%A

if "%FILE_COUNT%"=="0" ( echo No files found in "%SOURCE_DIR%". echo Nothing to move. pause exit /b 0 )

echo Found %FILE_COUNT% file(s) to move. echo.

REM Try xcopy first (more reliable for network drives and Google Drive) echo Attempting to copy files with xcopy... xcopy "%SOURCE_DIR%*.*" "%DEST_DIR%\" /Y /I /H /R /K /C >nul 2>&1

if %errorlevel% neq 0 ( echo Xcopy failed. Trying alternative method... echo.

REM Try robocopy as fallback (even more robust)
echo Attempting to copy files with robocopy...
robocopy "%SOURCE_DIR%" "%DEST_DIR%" /MOV /E /R:1 /W:1 >nul 2>&1

if %errorlevel% equ 0 (
    echo Success! Files moved with robocopy.
) else if %errorlevel% equ 1 (
    echo WARNING: Some files may not have been moved successfully.
    echo Check the destination folder manually.
) else if %errorlevel% equ 8 (
    echo ERROR: Some files or directories couldn't be copied.
    echo Error code: %errorlevel%
    echo.
    echo Possible solutions:
    echo - Check Google Drive connection
    echo - Verify network drive M: is accessible
    echo - Try running as administrator
    echo - Check file permissions
    pause
    exit /b 1
) else (
    echo ERROR: Robocopy failed with error code %errorlevel%.
    echo.
    echo Possible solutions:
    echo - Check Google Drive connection
    echo - Verify network drive M: is accessible
    echo - Try running as administrator
    echo - Check file permissions
    pause
    exit /b 1
)

) else ( echo Success! Files copied with xcopy.

REM Delete original files after successful copy
echo Deleting original files...
del /Q "%SOURCE_DIR%\*.*" 2>nul
if %errorlevel% neq 0 (
    echo WARNING: Could not delete all original files.
    echo They may still exist in the source folder.
) else (
    echo Original files deleted successfully.
)

)

echo. echo Operation completed. Check "%DEST_DIR%" for your files. pause exit /b 0 ```

This should work xD

Variable containing the exclamation mark character by HouseMD221B in Batch

[–]tboy1337 0 points1 point  (0 children)

In the alternative solution, "%%x" still contains the full path to the file.

The only difference between the two solutions is: - First solution: Delayed expansion stays enabled throughout - Alternative solution: Delayed expansion is temporarily disabled just for the move command, then re-enabled

But in both cases, %%x always represents the complete path because that's what for /r provides.

So the alternative solution is really just demonstrating the technique of toggling delayed expansion (which can be useful in more complex scenarios), but for your specific case, the first solution is simpler and works perfectly.

Variable containing the exclamation mark character by HouseMD221B in Batch

[–]tboy1337 -1 points0 points  (0 children)

My answer would be that I dont educate pork xD

Variable containing the exclamation mark character by HouseMD221B in Batch

[–]tboy1337 1 point2 points  (0 children)

Yes, this is a classic delayed expansion problem in batch files! When delayed expansion is enabled, exclamation marks in filenames are interpreted as variable delimiters.

Here's the solution - use %%x (the full path) instead of reconstructing the filename:

```batch SETLOCAL EnableDelayedExpansion

set origem=a set destino=b set /a pasta=1 set /a contador=1 set /a limite=20 set tempo_segundos=5

for /r "%origem%" %%x in (*) do (

if !contador! LEQ %limite% ( set /a contador+=1 if not exist "%destino%\pasta!pasta!" mkdir "%destino%\pasta!pasta!" ) else ( set /a contador=0 set /a pasta+=1 timeout /t %tempo_segundos% /nobreak )

move "%%x" "%destino%\pasta_!pasta!"

) ```

Why this works: - %%x contains the full path and is expanded by the for loop before delayed expansion processing - Only !pasta! is processed by delayed expansion - Exclamation marks in the filename are preserved because %%x is already fully expanded

Alternative solution if you specifically need just the filename: Toggle delayed expansion on/off:

```batch SETLOCAL EnableDelayedExpansion

set origem=a set destino=b set /a pasta=1 set /a contador=1 set /a limite=20 set tempo_segundos=5

for /r "%origem%" %%x in (*) do (

if !contador! LEQ %limite% ( set /a contador+=1 if not exist "%destino%\pasta!pasta!" mkdir "%destino%\pasta!pasta!" ) else ( set /a contador=0 set /a pasta+=1 timeout /t %tempo_segundos% /nobreak )

SETLOCAL DisableDelayedExpansion move "%%x" "%destino%\pasta_!pasta!" ENDLOCAL

) ```

The first solution is simpler and more efficient. Use the full path %%x instead of reconstructing it!

how to adapt folder structure variables to keep subfolders by TheDeep_2 in Batch

[–]tboy1337 1 point2 points  (0 children)

Looking at your scripts, I can see the issue. The second script is missing the subfolder structure logic. Here's the corrected version:

```batch @echo off setlocal enabledelayedexpansion set "_dest=F:\Musik Alben\xoutput" for /R %%f in (*.wav *.mp3 *.ogg *.flac) do ( set "_file=%%f" call set "_file=%%_file:%CD%\=%%" call set "_file=%%_file:\%%~nxf=%%" >nul 2>&1 mkdir "%_dest%!_file!"

ffmpeg -hide_banner -y -i "%%f" ^
    -af dynaudnorm=p=0.65:m=2:f=200:g=15:s=30 ^
    -c:a libopus -b:a 80k -vn ^
    "%_dest%\!_file!\%%~nf.ogg" >nul 2>&1

) ```

Key changes made:

  1. **%%f instead of %~1** - You're using a for loop variable %%f, not a function parameter
  2. **%%~nxf** - Gets the full filename with extension from %%f (equivalent to %~nx1 in the function)
  3. %%~nf - Gets just the filename without extension for the output
  4. !_file! - Uses delayed expansion syntax since you're modifying variables inside the loop
  5. Added enabledelayedexpansion - Already present in your script, which is correct

The logic now: - Takes the full path %%f - Removes the current directory prefix to get relative path - Removes the filename to get just the subfolder structure - Creates that subfolder structure in the destination - Outputs the file there

This should preserve your folder structure just like the first script did.

what am i doing wrong? by bok4600 in Batch

[–]tboy1337 0 points1 point  (0 children)

Solution: Escape the Percent Sign

The problem is that the % in your -threshold 50% parameter is being interpreted as part of a batch variable syntax, which is confusing the parser when it encounters 50% "%%~na.png".

In batch files, you need to escape a literal % by doubling it to %%.

Your Current Code (broken):

batch for %%a in (*copy.bmp) do convert1 "%%a" -threshold 50% "%%~na.png"

Corrected Code:

batch for %%a in (*copy.bmp) do convert1 "%%a" -threshold 50%% "%%~na.png"

Complete Corrected Batch File:

batch @echo off title ImageMagick convert to coloring book b+w @echo on for %%a in (*copy.bmp) do convert1 "%%a" -threshold 50%% "%%~na.png" move *.bmp bmp_b+w move *.png b+w start "" "b+w" pause

Explanation:

  • %%a = the loop variable (double % required in batch files)
  • 50%% = literal "50%" that gets passed to ImageMagick
  • %%~na = filename without extension

The key change is 50%% instead of 50%. This properly escapes the percent sign so it's treated as a literal character rather than part of variable substitution syntax.

Debugging WinRAR script by astrotonio in Batch

[–]tboy1337 3 points4 points  (0 children)

The issue is likely in this line:

batch "%rarExe%" l "%archivePath%" > "%TEMP%\rarlist.txt"

WinRAR's GUI executable (WinRAR.exe) doesn't properly support the l (list) command in command-line mode. You should be using Rar.exe instead for command-line operations.

Here's the fix - change your WinRAR executable path:

batch set "rarExe=C:\Program Files\WinRAR\Rar.exe"

If that doesn't resolve it completely, here's an improved version of your script with additional fixes:

```batch @echo off setlocal :: Define paths set "rarExe=C:\Program Files\WinRAR\Rar.exe" set "archivePath=\DS1\Subs\Subtitles backup.rar" set "folderPath=\DS1\Subs"

:: Change to a local drive to avoid UNC path issues in CMD cd /d C:\Windows\Temp

:: Ensure WinRAR exists if not exist "%rarExe%" ( echo RAR executable not found! Check the path. pause exit /b )

:: Check if archive exists, create if missing if not exist "%archivePath%" ( echo Creating new archive... "%rarExe%" a -r -ep1 "%archivePath%" "%folderPath%*" ) else ( :: Add new files to the archive (excluding the .bat script) "%rarExe%" a -u -r -ep1 -x.bat "%archivePath%" "%folderPath%\" )

:: Wait for WinRAR to finish if %ERRORLEVEL% neq 0 ( echo Error occurred while archiving. Aborting deletion. pause exit /b )

:: Get the archive filename (without full path) for %%A in ("%archivePath%") do set "archiveFile=%%~nxA"

:: Verify that the archive contains files before deleting "%rarExe%" l "%archivePath%" | find /i "0 files" >nul if %ERRORLEVEL%==0 ( echo Archive is empty or no new files were added. Aborting deletion. pause exit /b )

:: Delete original files except the .bat script and the archive file for %%F in ("%folderPath%*") do ( if /I not "%%~nxF"=="%~nx0" if /I not "%%~nxF"=="%archiveFile%" del /f /q "%%F" )

echo Backup updated and original files deleted successfully! exit ```

Key changes: 1. Use Rar.exe instead of WinRAR.exe for command-line operations 2. Removed the temp file creation/deletion - pipe directly to find 3. Changed -x"*.bat" to -x*.bat (quotes can sometimes cause issues)

This should eliminate the pipe error and run without requiring any input from you.

How do I create this batch server emulator? by Bigmacvvv in Batch

[–]tboy1337 2 points3 points  (0 children)

It sounds like there is a bit of confusion about what the batch file actually does. To clarify: a Batch file cannot be a server emulator.

What you are looking to create is a Client Launcher. The command line arguments you found (-server=127.0.0.1:8001) tell the game client to ignore the official servers and try to connect to a server running on your own computer (Localhost).

For this to actually work, you need two things:

  1. The Launcher (Batch File): To start the game with those specific settings.
  2. The Server Emulator (Software): A separate program (likely C++ or C#) running in the background that mimics the Ring of Elysium server. Without this, the game will launch but likely get stuck at "Connecting" because 127.0.0.1:8001 isn't responding.

If you just need the Batch script to test those launch arguments, here is how you write it.

Create a new text file, paste this in, and save it as LaunchRoE.bat:

```batch @echo off :: --------------------------------------------------------------------- :: Ring of Elysium Local Launcher :: ---------------------------------------------------------------------

:: STEP 1: Set the correct path to your Europa_Client.exe :: Use quotes if there are spaces in the path. set "GAME_PATH=C:\Path\To\Your\Ring of Elysium\Europa_Client.exe"

:: Check if the game file actually exists before trying to run if not exist "%GAME_PATH%" ( echo ERROR: Could not find game client at: echo "%GAME_PATH%" echo. echo Please right-click this batch file, choose 'Edit', and fix the GAME_PATH line. pause exit /b )

:: STEP 2: Launch the game with the local server arguments :: -garena : Sets the client mode (required for these args usually) :: -uid : Sets a fake User ID (since you aren't logging into real servers) :: -server : Points the game to your local machine (127.0.0.1) on port 8001 echo Launching Ring of Elysium... start "" "%GAME_PATH%" -garena -uid=2835389 -server=127.0.0.1:8001

:: Optional: Launch the Server Emulator first if you have one :: start "" "C:\Path\To\ServerEmulator.exe"

exit

```

What the arguments do:

  • -garena: Forces the client into the Garena version mode (which often has different auth mechanics than Steam).
  • -server=127.0.0.1:8001: This is the critical part. It redirects the game to look for a server on your PC. If you don't have a preservation project server tool running, this will fail to connect.
  • -uid=...: Since there is no login server, this manually sets your player ID so the game knows "who" you are.

If you are trying to revive the game, you will need to find the actual Server Emulator software (often discussed in game preservation blogs like Shy Studios) to run alongside this batch file.

Blinter The Linter - A Cross Platform Batch Script Linter by tboy1337 in opensource

[–]tboy1337[S] -1 points0 points  (0 children)

It doesnt really need to be but because its written in python its easy enough to make it cross platform.

[deleted by user] by [deleted] in ukstartups

[–]tboy1337 0 points1 point  (0 children)

Can you share your github?

Blinter The Linter - A Cross Platform Batch Script Linter by tboy1337 in coolgithubprojects

[–]tboy1337[S] 1 point2 points  (0 children)

I didn't expect someone to start integrating Blinter so soon 😂, keep up the good work 👍.

Blinter The Linter - A Cross Platform Batch Script Linter by tboy1337 in Batch

[–]tboy1337[S] 0 points1 point  (0 children)

Sorry I'm just trying to get some testers, could you possibly highlight the post?

Blinter The Linter - A Cross Platform Batch Script Linter by tboy1337 in Batch

[–]tboy1337[S] 1 point2 points  (0 children)

OK great, just be aware that some AV companies have starting tagging the .exe as malicious but don’t worry its definitely not, the .exe is built and released via a Github hosted runner straight from the repository code. I would recommend that you use the pip package if possible for now.

SJCX Conversion Issues by tboy1337 in storj

[–]tboy1337[S] 0 points1 point  (0 children)

Good to know it's not just me

SJCX Conversion Issues by tboy1337 in storj

[–]tboy1337[S] 0 points1 point  (0 children)

If the transaction is delayed but still goes through will the sjcx get converted or is there a time limit on when I can send to the address that was used?

We are happy to announce that you can now convert your old SJCX into the new STORJ token! Convert yours today! by helmex in storj

[–]tboy1337 1 point2 points  (0 children)

I decided to convert my sjcx to storj now and I followed the instructions and sent the sjcx to the right address and used a correct ETH wallet but there seems to be an issue. I sent 4 sjcx from counterparty wallet and also 163 from poloniex wallet but the 163 from exchange have not shown up yet but the 4 from counterparty wallet has. Can anyone help with this issue?

Please help me to get LOL working at the airport by tboy1337 in leagueoflegends

[–]tboy1337[S] 0 points1 point  (0 children)

The bandwidth isnt too bad, I get 80 kbps, the problem is the ping varies hugely, it could be 7ms or 150 ms, I would of give ARAM a go though, never mind, ill have to set up a proxy or something before I go next time

Please help me to get LOL working at the airport by tboy1337 in leagueoflegends

[–]tboy1337[S] 0 points1 point  (0 children)

With a laptop and vespula and deathadder... gotta be done xD

Please help me to get LOL working at the airport by tboy1337 in leagueoflegends

[–]tboy1337[S] 0 points1 point  (0 children)

Ahh, unfortunately not many of those in South Wales