Skip to main content
added 138 characters in body
Source Link
krowe
  • 5.6k
  • 1
  • 25
  • 31

Just use the CALL statement to tell the batch script to wait while the program is open:

@ECHO OFF
RENAME "C:\users\my profile\my word documents" "my documents"
CALL "C:\Program Files\Microsoft Office\Office15\winword.exe"
RENAME "C:\users\my profile\my documents" "my word documents"

Just don't close the batch window yourself or else the folder won't be renamed back afterwards. You can minimize the likelihood of that happening by using a shortcut to run the script minimized or use VBS to run it hidden.

Update

I think this should accomplish the (nearly) equivalent task as you asked for without all of the headache. By simply keeping the intermediate copies around you should be able to achieve what you really want (which we are all still guessing at).

@ECHO OFF
SET source=C:\test
SET dest=C:\test_tmp

MKDIR "%dest%"
COPY /Y "%source%\*.*" "%dest%\"
CALL "C:\Program Files\Microsoft Office\Office15\winword.exe"
RMDIR /S /Q "%source%"
MKDIR "%source%"
COPY /Y "%dest%\*.*" "%source%\"
RMDIR /S /Q "%dest%"

If this isn't good enough for you then your best bet is to make a VBA script or .NET extension Application-Level Add-Ins for part of this because this can't really be done in BATCH alone.

Just use the CALL statement to tell the batch script to wait while the program is open:

@ECHO OFF
RENAME "C:\users\my profile\my word documents" "my documents"
CALL "C:\Program Files\Microsoft Office\Office15\winword.exe"
RENAME "C:\users\my profile\my documents" "my word documents"

Just don't close the batch window yourself or else the folder won't be renamed back afterwards. You can minimize the likelihood of that happening by using a shortcut to run the script minimized or use VBS to run it hidden.

Update

I think this should accomplish the (nearly) equivalent task as you asked for without all of the headache.

@ECHO OFF
SET source=C:\test
SET dest=C:\test_tmp

MKDIR "%dest%"
COPY /Y "%source%\*.*" "%dest%\"
CALL "C:\Program Files\Microsoft Office\Office15\winword.exe"
RMDIR /S /Q "%source%"
MKDIR "%source%"
COPY /Y "%dest%\*.*" "%source%\"
RMDIR /S /Q "%dest%"

If this isn't good enough for you then your best bet is to make a VBA script or .NET extension for part of this.

Just use the CALL statement to tell the batch script to wait while the program is open:

@ECHO OFF
RENAME "C:\users\my profile\my word documents" "my documents"
CALL "C:\Program Files\Microsoft Office\Office15\winword.exe"
RENAME "C:\users\my profile\my documents" "my word documents"

Just don't close the batch window yourself or else the folder won't be renamed back afterwards. You can minimize the likelihood of that happening by using a shortcut to run the script minimized or use VBS to run it hidden.

Update

I think this should accomplish the (nearly) equivalent task as you asked for without all of the headache. By simply keeping the intermediate copies around you should be able to achieve what you really want (which we are all still guessing at).

@ECHO OFF
SET source=C:\test
SET dest=C:\test_tmp

MKDIR "%dest%"
COPY /Y "%source%\*.*" "%dest%\"
CALL "C:\Program Files\Microsoft Office\Office15\winword.exe"
RMDIR /S /Q "%source%"
MKDIR "%source%"
COPY /Y "%dest%\*.*" "%source%\"
RMDIR /S /Q "%dest%"

If this isn't good enough for you then your best bet is to make a VBA script or .NET Application-Level Add-Ins for part of this because this can't really be done in BATCH alone.

added 232 characters in body
Source Link
krowe
  • 5.6k
  • 1
  • 25
  • 31

Just use the CALL statement to tell the batch script to wait while the program is open:

@ECHO OFF
RENAME "C:\users\my profile\my word documents" "my documents"
CALL "C:\Program Files\Microsoft Office\Office15\winword.exe"
RENAME "C:\users\my profile\my documents" "my word documents"

Just don't close the batch window yourself or else the folder won't be renamed back afterwards. You can minimize the likelihood of that happening by using a shortcut to run the script minimized or use VBS to run it hidden.

Update

I think this should accomplish the (nearly) equivalent task as you asked for without all of the headache.

@ECHO OFF
SET source=C:\test
SET dest=C:\test_tmp

MKDIR "%dest%"
COPY /Y "%source%\*.*" "%dest%\"
CALL "C:\Program Files\Microsoft Office\Office15\winword.exe"
RMDIR /S /Q "%source%"
MKDIR "%source%"
COPY /Y "%dest%\*.*" "%source%\"
RMDIR /S /Q "%dest%"

If this isn't good enough for you then your best bet is to make a VBA script or .NET extension for part of this.

Just use the CALL statement to tell the batch script to wait while the program is open:

@ECHO OFF
RENAME "C:\users\my profile\my word documents" "my documents"
CALL "C:\Program Files\Microsoft Office\Office15\winword.exe"
RENAME "C:\users\my profile\my documents" "my word documents"

Just don't close the batch window yourself or else the folder won't be renamed back afterwards. You can minimize the likelihood of that happening by using a shortcut to run the script minimized or use VBS to run it hidden.

Update

I think this should accomplish the equivalent task without all of the headache.

@ECHO OFF
SET source=C:\test
SET dest=C:\test_tmp

MKDIR "%dest%"
COPY /Y "%source%\*.*" "%dest%\"
CALL "C:\Program Files\Microsoft Office\Office15\winword.exe"
RMDIR /S /Q "%source%"
MKDIR "%source%"
COPY /Y "%dest%\*.*" "%source%\"
RMDIR /S /Q "%dest%"

Just use the CALL statement to tell the batch script to wait while the program is open:

@ECHO OFF
RENAME "C:\users\my profile\my word documents" "my documents"
CALL "C:\Program Files\Microsoft Office\Office15\winword.exe"
RENAME "C:\users\my profile\my documents" "my word documents"

Just don't close the batch window yourself or else the folder won't be renamed back afterwards. You can minimize the likelihood of that happening by using a shortcut to run the script minimized or use VBS to run it hidden.

Update

I think this should accomplish the (nearly) equivalent task as you asked for without all of the headache.

@ECHO OFF
SET source=C:\test
SET dest=C:\test_tmp

MKDIR "%dest%"
COPY /Y "%source%\*.*" "%dest%\"
CALL "C:\Program Files\Microsoft Office\Office15\winword.exe"
RMDIR /S /Q "%source%"
MKDIR "%source%"
COPY /Y "%dest%\*.*" "%source%\"
RMDIR /S /Q "%dest%"

If this isn't good enough for you then your best bet is to make a VBA script or .NET extension for part of this.

added 326 characters in body
Source Link
krowe
  • 5.6k
  • 1
  • 25
  • 31

Just use the CALL statement to tell the batch script to wait while the program is open:

@ECHO OFF
RENAME "C:\users\my profile\my word documents" "my documents"
CALL "C:\Program Files\Microsoft Office\Office15\winword.exe"
RENAME "C:\users\my profile\my documents" "my word documents"

Just don't close the batch window yourself or else the folder won't be renamed back afterwards. You can minimize the likelihood of that happening by using a shortcut to run the script minimized or use VBS to run it hidden.

Update

I think this should accomplish the equivalent task without all of the headache.

@ECHO OFF
SET source=C:\test
SET dest=C:\test_tmp

MKDIR "%dest%"
COPY /Y "%source%\*.*" "%dest%\"
CALL "C:\Program Files\Microsoft Office\Office15\winword.exe"
RMDIR /S /Q "%source%"
MKDIR "%source%"
COPY /Y "%dest%\*.*" "%source%\"
RMDIR /S /Q "%dest%"

Just use the CALL statement to tell the batch script to wait while the program is open:

@ECHO OFF
RENAME "C:\users\my profile\my word documents" "my documents"
CALL "C:\Program Files\Microsoft Office\Office15\winword.exe"
RENAME "C:\users\my profile\my documents" "my word documents"

Just don't close the batch window yourself or else the folder won't be renamed back afterwards. You can minimize the likelihood of that happening by using a shortcut to run the script minimized or use VBS to run it hidden.

Just use the CALL statement to tell the batch script to wait while the program is open:

@ECHO OFF
RENAME "C:\users\my profile\my word documents" "my documents"
CALL "C:\Program Files\Microsoft Office\Office15\winword.exe"
RENAME "C:\users\my profile\my documents" "my word documents"

Just don't close the batch window yourself or else the folder won't be renamed back afterwards. You can minimize the likelihood of that happening by using a shortcut to run the script minimized or use VBS to run it hidden.

Update

I think this should accomplish the equivalent task without all of the headache.

@ECHO OFF
SET source=C:\test
SET dest=C:\test_tmp

MKDIR "%dest%"
COPY /Y "%source%\*.*" "%dest%\"
CALL "C:\Program Files\Microsoft Office\Office15\winword.exe"
RMDIR /S /Q "%source%"
MKDIR "%source%"
COPY /Y "%dest%\*.*" "%source%\"
RMDIR /S /Q "%dest%"
added 110 characters in body
Source Link
krowe
  • 5.6k
  • 1
  • 25
  • 31
Loading
Source Link
krowe
  • 5.6k
  • 1
  • 25
  • 31
Loading