אחסון קבצים בתוך batch file. - תכנות - HWzone פורומים
עבור לתוכן
  • צור חשבון

אחסון קבצים בתוך batch file.


THE-MASTER

Recommended Posts

האם יש דרך כלשהי ליצור קובץ BATCH FILE שאני אאחסן בן קבצים כך שאני אפעיל אותו הוא יוכל לשלוח קבצים לכל מיני מקומות במחשב.

לדוגמא @echo off

copy c:\lallal d:\aa

בדוגמא זאת הקובץ מעביר את היישום lallal לתיקייה aa /

עכשיו האם יש אפשרות כלשהי להכניס את הקובץ lallal לתוך קובץ הBATCH FILE ולהעתיק אותו למיקום המבוקש מתוך הקובץ BATCH .

קישור לתוכן
שתף באתרים אחרים

קובץ batch הוא קובץ טקסט בתור כזה הוא לא יכול להכיל תווי בקרה של ASCII.

קובץ בינארי מכיל בדרך כלל ערכים מתחת ל- ASCII 32, שהם תווי בקרה.

לכן גם אם יש לך קובץ שמתחיל כקובץ batch ומכיל קובץ בינארי כמו שהוא, לא תוכל להעתיק מתוכו את הקטע הבינארי.

אגב, תחת , קבצי bat יכולים לשנות את עצמם,

למשל אם תריץ קובץ שנקרא test.bat

שמסתיים בשורה echo test >> test.bat תקבל רקורסיה ;D

אבל למה להעתיק קובץ אל תוך הקובץ שלך? למה לא לשמור פשוט את המיקום שלו, או להעתיק אותו למקום מסוים?

קישור לתוכן
שתף באתרים אחרים

אני לא מעוניין בשום וירוס כל כוונתי היא לנסות בצורה כלשהי Batch file יצור את הקובץ AUTOEXEC.NT וישלח אותו לתיקיית SYSTEM32 /

כל המטרה היא ליצור FIX לבעייה הידועה(The system file is not suitable.....). אז אם יש דרך כלשהי אשמח לשמוע.

דרך אגב אני כמעט בטוח שאפשר רק אני לא יודע איך.

פתחתי את הקובץ AUTOEXEC עם מסמך טקסט והנה מה שיצא.

@echo off

REM AUTOEXEC.BAT is not used to initialize the MS-DOS environment.

REM AUTOEXEC.NT is used to initialize the MS-DOS environment unless a

REM different startup file is specified in an application's PIF.

REM Install CD ROM extensions

lh %SystemRoot%\system32\mscdexnt.exe

REM Install network redirector (load before dosx.exe)

lh %SystemRoot%\system32\redir

REM Install DPMI support

lh %SystemRoot%\system32\dosx

REM The following line enables Sound Blaster 2.0 support on NTVDM.

REM The command for setting the BLASTER environment is as follows:

REM    SET BLASTER=A220 I5 D1 P330

REM    where:

REM        A    specifies the sound blaster's base I/O port

REM        I    specifies the interrupt request line

REM        D    specifies the 8-bit DMA channel

REM        P    specifies the MPU-401 base I/O port

REM        T    specifies the type of sound blaster card

REM                 1 - Sound Blaster 1.5

REM                 2 - Sound Blaster Pro I

REM                 3 - Sound Blaster 2.0

REM                 4 - Sound Blaster Pro II

REM                 6 - SOund Blaster 16/AWE 32/32/64

REM

REM    The default value is A220 I5 D1 T3 and P330.  If any of the switches is

REM    left unspecified, the default value will be used. (NOTE, since all the

REM    ports are virtualized, the information provided here does not have to

REM    match the real hardware setting.)  NTVDM supports Sound Blaster 2.0 only.

REM    The T switch must be set to 3, if specified.

SET BLASTER=A220 I5 D1 P330 T3

REM To disable the sound blaster 2.0 support on NTVDM, specify an invalid

REM SB base I/O port address.  For example:

REM    SET BLASTER=A0

עכשיו נמקד את השאלה ..

איך אני הופך את המלל הזה לקובץ NT????

קישור לתוכן
שתף באתרים אחרים

לא הבנתי (ואני לא מכיר את "הבעיה הידועה...)

אתה רוצה לכתוב משהו לתוך קובץ מסוים? מה בדיוק?

בקבצי batch אתה יכול לכתוב לקובץ ע"י

echo "some text"> somefile

ואתה יכול להוסיף לקובץ קיים עם << במקום <.

קישור לתוכן
שתף באתרים אחרים

זה התוכנית שעשיתי אני חושב שככה היא עובדת כבר(המיקום רק צריך להיות בתיקיית SYSTEM32)

בכל אופן בתוכנית יש רווחים ואני מעוניים לשמור עליהם במסמך AUTOEXEC שיוווצר איך אני עושה זאת??

תודה רבה לBOOMERANG על העזרה פה וגם בתרד "בעיה בהעברת קבצים"(זה הדבר שהכי ש?מח אותי השבוע).

echo @echo off>c:\autoexec.txt

echo REM AUTOEXEC.BAT is not used to initialize the MS-DOS environment.>>c:\autoexec.txt

echo REM AUTOEXEC.NT is used to initialize the MS-DOS environment unless a>>c:\autoexec.txt

echo REM different startup file is specified in an application's PIF.>>c:\autoexec.txt

echo REM Install CD ROM extensions>>c:\autoexec.txt

echo lh %SystemRoot%\system32\mscdexnt.exe>>c:\autoexec.txt

echo REM Install network redirector (load before dosx.exe)>>c:\autoexec.txt

echo lh %SystemRoot%\system32\redir>>c:\autoexec.txt

echo REM Install DPMI support>>c:\autoexec.txt

echo lh %SystemRoot%\system32\dosx>>c:\autoexec.txt

echo REM The following line enables Sound Blaster 2.0 support on NTVDM.>>c:\autoexec.txt

echo REM The command for setting the BLASTER environment is as follows:>>c:\autoexec.txt

echo REM SET BLASTER=A220 I5 D1 P330>>c:\autoexec.txt

echo REM where:>>c:\autoexec.txt

echo REM A specifies the sound blaster's base I/O port>>c:\autoexec.txt

echo REM I specifies the interrupt request line>>c:\autoexec.txt

echo REM D specifies the 8-bit DMA channel>>c:\autoexec.txt

echo REM P specifies the MPU-401 base I/O port>>c:\autoexec.txt

echo REM T specifies the type of sound blaster card>>c:\autoexec.txt

echo REM 1 - Sound Blaster 1.5>>c:\autoexec.txt

echo REM 2 - Sound Blaster Pro I>>c:\autoexec.txt

echo REM 3 - Sound Blaster 2.0>>c:\autoexec.txt

echo REM 4 - Sound Blaster Pro II>>c:\autoexec.txt

echo REM 6 - SOund Blaster 16/AWE 32/32/64>>c:\autoexec.txt

echo REM>>c:\autoexec.txt

echo REM The default value is A220 I5 D1 T3 and P330. If any of the switches is>>c:\autoexec.txt

echo REM left unspecified, the default value will be used. (NOTE, since all the>>c:\autoexec.txt

echo REM ports are virtualized, the information provided here does not have to>>c:\autoexec.txt

echo REM match the real hardware setting.) NTVDM supports Sound Blaster 2.0 only.>>c:\autoexec.txt

echo REM The T switch must be set to 3, if specified.>>c:\autoexec.txt

echo SET BLASTER=A220 I5 D1 P330 T3>>c:\autoexec.txt

echo REM To disable the sound blaster 2.0 support on NTVDM, specify an invalid>>c:\autoexec.txt

echo REM SB base I/O port address. For example:>>c:\autoexec.txt

echo REM SET BLASTER=A0>>c:\autoexec.txt

ren c:\autoexec.txt autoexec.nt

ATTRIB +R c:\autoexec.nt

קישור לתוכן
שתף באתרים אחרים

שמע, כל ה-REM הזה מיותר לחלוטין.

אתה יכול להסתפק בזה:

echo @echo off>c:\autoexec.txt

echo lh %SystemRoot%\system32\mscdexnt.exe>>c:\autoexec.txt

echo lh %SystemRoot%\system32\redir>>c:\autoexec.txt

echo lh %SystemRoot%\system32\dosx>>c:\autoexec.txt

ren c:\autoexec.txt autoexec.nt

ATTRIB +R c:\autoexec.nt

קישור לתוכן
שתף באתרים אחרים

שמע, כל ה-REM הזה מיותר לחלוטין.

אתה יכול להסתפק בזה:

תודה רבה,חשבתי להשאיר את המסמך המקורי בגלל שלא ידעתי בדיוק מה אפשר להוריד.

עריכה:בדקתי את הקובץ והוא סידר את הבעיה בהצלחה.

קישור לתוכן
שתף באתרים אחרים

זה ההודעה המלאה..

c:\windows\system32\autoexec.nt. The system file is not suitable for runing ms-dos and application

נאמני הפורום יוכלו לומר לך שהבעיה הזאת די שכיחה.

דרך אגב אם למישהו יש את הבעיה הזאת שיעתיק את המלל הבא יכניס למסמך טקסט ישמור בשם NAME.BAT יפתח אותו ונפתרה הבעיה

echo @echo off>c:\WINDOWS\SYSTEM32\autoexec.txt

echo lh %SystemRoot%\system32\mscdexnt.exe>>c:\WINDOWS\SYSTEM32\autoexec.txt

echo lh %SystemRoot%\system32\redir>>c:\WINDOWS\SYSTEM32\autoexec.txtt

echo lh %SystemRoot%\system32\dosx>>c:\WINDOWS\SYSTEM32\autoexec.txt

ren c:\WINDOWS\SYSTEM32\autoexec.txt autoexec.nt

ATTRIB +R c:\WINDOWS\SYSTEM32\autoexec.nt

קישור לתוכן
שתף באתרים אחרים

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

×
  • צור חדש...